JetCore/__jet.cpp
2024-11-23 19:25:14 -08:00

34 lines
1.0 KiB
C++

#include "__jet.h"
#include "Exception.h"
#include <iostream>
#include <fstream>
namespace jet {
__jet::__jet(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent) : Tag(in, parentOut, global, parent) {
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);
outFile << postdata << std::endl;
outFile.close();
if(contentType == "multipart/form-data")
global.setupFormData(postdata);
// else if(contentType == "application/x-www-form-urlencoded")
// std::cout << "output urlencoded variables to global" << std::endl;
}
}
processContainer(container);
}
}