some cgi variable work.
This commit is contained in:
1 parent
64fd81d6ed
commit
c21dea1411
5 files changed
+66
-30
No files matched your search
+30
-1
@@ -136,5 +136,34 @@ namespace jet {
|
||||
std::cout << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Global::setupFormData(coreutils::ZString &formdata) {
|
||||
|
||||
coreutils::ZString boundary = formdata.goeol();
|
||||
while(!formdata.eod()) {
|
||||
if(formdata.ifNext("Content-Disposition: form-data;")) {
|
||||
formdata.skipWhitespace();
|
||||
if(formdata.ifNext("name=\"")) {
|
||||
coreutils::ZString name = formdata.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-");
|
||||
if(formdata.ifNext("\"")) {
|
||||
formdata.goeol();
|
||||
formdata.goeol();
|
||||
coreutils::ZString data = formdata.getTokenExclude("-"); // TODO: Fix this parsing. Need a string exclusion method to check for 'boundary'.
|
||||
data.trimCRLF();
|
||||
formdata.ifNext(boundary);
|
||||
cgiVariables[name] = data;
|
||||
std::cout << name << ":[" << data << "]" << std::endl;
|
||||
if(formdata.ifNext("--"))
|
||||
break;
|
||||
formdata.goeol();
|
||||
}
|
||||
else
|
||||
throw coreutils::Exception("expecting closing double quote on vairable name in received CGI data.");
|
||||
} else
|
||||
throw coreutils::Exception("expecting name subfield in received CGI data.");
|
||||
} else
|
||||
throw coreutils::Exception("expecting Content-Disposition header in received CGI data.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user