#include "__jet.h" #include "Exception.h" #include #include namespace jet { __jet::__jet(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, Tag *local) : Tag(in, parentOut, global, parent, this) { if(variableDefined("cgi")) resolveKeyword("cgi"); if(variables["cgi"] == "true") { coreutils::ZString requestMethod(getenv("REQUEST_METHOD")); if(requestMethod == "POST") { coreutils::ZString contentLength(getenv("CONTENT_LENGTH")); coreutils::ZString contentType(getenv("CONTENT_TYPE")); std::ofstream outFile("/tmp/output.txt"); coreutils::MString postdata; postdata.read(0); // TODO: Need to limit the read characters to the CONTENT-LENGTH value; if(contentType == "multipart/form-data") global.setupFormData(postdata); else if(contentType == "application/x-www-form-urlencoded") global.setupFormURLEncoded(postdata); } } processContainer(container); } }