urlencoded forms data is now workng as well.
This commit is contained in:
1 parent
c90c7353c7
commit
a9ce087939
8 files changed
+61
-11
No files matched your search
+21
-6
@@ -1,7 +1,6 @@
|
||||
#include "Global.h"
|
||||
#include "Exception.h"
|
||||
#include "__mysql.h"
|
||||
#include "Modifiers.h"
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -39,7 +38,6 @@ namespace jet {
|
||||
}
|
||||
|
||||
coreutils::MString& Global::processModifier(coreutils::MString &value, coreutils::MString &modifier) {
|
||||
Modifiers modifiers;
|
||||
if(modifier.getLength() == 0)
|
||||
return value;
|
||||
if(modifier == "tobinary")
|
||||
@@ -142,8 +140,7 @@ namespace jet {
|
||||
}
|
||||
}
|
||||
|
||||
void Global::setupFormData(coreutils::ZString &formdata) {
|
||||
|
||||
void Global::setupFormData(coreutils::ZString &formdata) {
|
||||
coreutils::ZString boundary = formdata.goeol();
|
||||
while(!formdata.eod()) {
|
||||
if(formdata.ifNext("Content-Disposition: form-data;")) {
|
||||
@@ -163,7 +160,6 @@ namespace jet {
|
||||
namex << name << ":" << index++;
|
||||
} while(cgiVariables.count(namex) != 0);
|
||||
cgiVariables[namex] = data;
|
||||
// std::cout << namex << ":[" << data << "]" << std::endl;
|
||||
if(formdata.ifNext("--"))
|
||||
break;
|
||||
formdata.goeol();
|
||||
@@ -176,5 +172,24 @@ namespace jet {
|
||||
throw coreutils::Exception("expecting Content-Disposition header in received CGI data.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Global::setupFormURLEncoded(coreutils::ZString &formdata) {
|
||||
while(!formdata.eod()) {
|
||||
coreutils::ZString name = formdata.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-");
|
||||
if(formdata.ifNext("=")) {
|
||||
coreutils::MString data = formdata.getTokenExclude("&");
|
||||
formdata.ifNext("&");
|
||||
int index = 0;
|
||||
coreutils::MString namex;
|
||||
do {
|
||||
namex = "";
|
||||
namex << name << ":" << index++;
|
||||
} while(cgiVariables.count(namex) != 0);
|
||||
modifiers.processFromCGIModifier(data, lastConverted);
|
||||
cgiVariables[namex] = lastConverted;
|
||||
} else
|
||||
throw coreutils::Exception("expecting = after name in received CGI data.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user