significant work on cookies and cgi formdata variables.

This commit is contained in:
Brad Arant 2025-03-18 16:46:39 -07:00
parent 050b5f2b87
commit 078ba7f81c
3 changed files with 10 additions and 12 deletions

View File

@ -9,13 +9,10 @@ namespace jet {
__jet::__jet(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, Tag *local) : Tag(in, parentOut, global, parent, this) { __jet::__jet(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, Tag *local) : Tag(in, parentOut, global, parent, this) {
char *cookies; char *cookies;
std::cout << "010" << std::endl;
if(keywordDefined("cgi") && (resolveKeyword("cgi") == "true")) { if(keywordDefined("cgi") && (resolveKeyword("cgi") == "true")) {
std::cout << "011" << std::endl;
global.cgi = true; global.cgi = true;
if(keywordDefined("sessiondir")) { if(keywordDefined("sessiondir")) {
std::cout << "012" << std::endl;
global.cookies = getenv("HTTP_COOKIE"); global.cookies = getenv("HTTP_COOKIE");
global.session = true; global.session = true;
// if request_has_cookie then // if request_has_cookie then
@ -43,19 +40,14 @@ namespace jet {
} }
std::cout << "013" << std::endl;
coreutils::ZString requestMethod(getenv("REQUEST_METHOD")); coreutils::ZString requestMethod(getenv("REQUEST_METHOD"));
if(requestMethod == "POST") { if(requestMethod == "POST") {
std::cout << "014: " << requestMethod << std::endl;
coreutils::ZString contentLength(getenv("CONTENT_LENGTH")); coreutils::ZString contentLength(getenv("CONTENT_LENGTH"));
coreutils::ZString contentType(getenv("CONTENT_TYPE")); coreutils::ZString contentType(getenv("CONTENT_TYPE"));
if(contentType == "multipart/form-data") { if(contentType == "multipart/form-data")
std::cout << "015" << std::endl; coreutils::IMFMultipart postdata(0, "");
coreutils::IMFMultipart postdata(0, contentLength.asInteger());
std::cout << "016" << std::endl;
}
// else if(contentType == "application/x-www-form-urlencoded") // else if(contentType == "application/x-www-form-urlencoded")
// global.setupFormURLEncoded(postdata); // global.setupFormURLEncoded(postdata);
} }

View File

@ -1,5 +1,11 @@
*** CGI VARIABLES ***
*** GLOBAL VARIABLES *** *** GLOBAL VARIABLES ***
*** LOCAL VARIABLES *** *** LOCAL VARIABLES ***
*** KEYWORD VALUES *** *** KEYWORD VALUES ***
cgi=[true]
sessiondir=[.] sessiondir=[.]
*** COOKIES *** *** COOKIES ***
$[^session]
<dump file="./d=[]
session=[18fd56a83f]

View File

@ -1,6 +1,6 @@
#!../jet-2.0 #!../jet-2.0
<upload name="imagefiledata" path="images/%name" /> <upload name="imagefiledata" path="images/%name" />
<jet cgi="true" sessiondir="."> <jet cgi="true" sessiondir=".">
$[^session]
<dump file="./dump.txt" /> <dump file="./dump.txt" />
</jet> </jet>