45 lines
1.5 KiB
C++
45 lines
1.5 KiB
C++
#include "__jet.h"
|
|
#include "Exception.h"
|
|
#include "Global.h"
|
|
#include "SessionId.h"
|
|
#include <stdlib.h>
|
|
#include <iostream>
|
|
#include <fstream>
|
|
|
|
namespace jet {
|
|
|
|
__jet::__jet(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, Tag *local) : Tag(in, parentOut, global, parent, this) {
|
|
char *cookies;
|
|
if(keywordDefined("cgi") && (resolveKeyword("cgi") == "true")) {
|
|
global.cgi = true;
|
|
|
|
if(keywordDefined("sessiondir")) {
|
|
global.session = true;
|
|
global.cookies = getenv("HTTP_COOKIE");
|
|
if(global.cookies.data["session"] != NULL) {
|
|
// pull sessionfile from sessiondir.
|
|
// if last activity time is expired then ignore.
|
|
// follow sessiontimeoutredirecturl.
|
|
} else {
|
|
SessionId sessionId;
|
|
global.headers["Set-Cookie"] << "session=" << sessionId;
|
|
global.cookies.data["session"] = sessionId;
|
|
if(keywordDefined("sessiontimeout")) {
|
|
time_t timeout = time(0) + keywords["sessiontimeout"].asInteger();
|
|
}
|
|
// also save last activity time in session file.
|
|
}
|
|
}
|
|
|
|
coreutils::ZString requestMethod(getenv("REQUEST_METHOD"));
|
|
if(requestMethod == "POST") {
|
|
coreutils::ZString contentLength(getenv("CONTENT_LENGTH"));
|
|
coreutils::ZString contentType(getenv("CONTENT_TYPE"));
|
|
|
|
formdata = new coreutils::CGIFormData(0, contentType, contentLength, boundary);
|
|
}
|
|
}
|
|
processContainer(container, NULL, true);
|
|
}
|
|
}
|