diff --git a/Global.cpp b/Global.cpp index 64b4cb8..c36636f 100644 --- a/Global.cpp +++ b/Global.cpp @@ -56,55 +56,4 @@ namespace jet { } } - 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); - int index = 0; - coreutils::MString namex; - do { - namex = ""; - namex << name << ":" << index++; - } while(cgiVariables.count(namex) != 0); - cgiVariables[namex] = data; - if(formdata.ifNext("--")) - break; - formdata.goeol(); - } - else - throw coreutils::Exception("expecting closing double quote on variable 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."); - } - } - - 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); - cgiVariables[namex] = data.fromCGI(); - } else - throw coreutils::Exception("expecting = after name in received CGI data."); - } - } - } diff --git a/Global.h b/Global.h index 8f8e7a3..381d54a 100644 --- a/Global.h +++ b/Global.h @@ -3,6 +3,7 @@ # include "MString.h" # include "CGIFormattedData.h" +# include "CGIFormData.h" # include namespace jet { @@ -27,7 +28,7 @@ namespace jet { char *errorCursor = NULL; coreutils::CGIFormattedData cookies; - coreutils::CGIFormData *formdata; + coreutils::CGIFormData *cgiData; std::map variables; std::map sessions; std::map headers; diff --git a/__jet.h b/__jet.h index 63c8b25..b25ddc1 100644 --- a/__jet.h +++ b/__jet.h @@ -3,8 +3,7 @@ #include "Tag.h" #include "ZString.h" -#include "IMFRequest.h" -#include "IMFMessage.h" +//#include "IMFMessage.h" #include namespace jet {