urlencoded forms data is now workng as well.

This commit is contained in:
brad Arant committed 2024-11-24 13:21:44 -08:00
1 parent c90c7353c7
commit a9ce087939
8 files changed
+61 -11

No files matched your search

+21 -6
View File
@@ -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.");
}
}
}