More session work.

This commit is contained in:
brad Arant 2025-03-17 07:44:36 -07:00
parent 60affa288e
commit d3cd5f3c9a
5 changed files with 16 additions and 39 deletions

View File

@ -29,6 +29,10 @@ namespace jet {
for (auto i = parent->keywords.begin(); i != parent->keywords.end(); i++)
outFile << i->first << "=[" << i->second << "]" << std::endl;
outFile << "*** COOKIES ***" << std::endl;
for (auto i = global.cookies.data.begin(); i != global.cookies.data.end(); i++)
outFile << i->first << "=[" << i->second << "]" << std::endl;
outFile.close();
}

View File

@ -9,11 +9,14 @@ namespace jet {
__jet::__jet(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, Tag *local) : Tag(in, parentOut, global, parent, this) {
char *cookies;
std::cout << "010" << std::endl;
if(keywordDefined("cgi") && (resolveKeyword("cgi") == "true")) {
std::cout << "011" << std::endl;
global.cgi = true;
if(keywordDefined("sessiondir")) {
cookies = getenv("HTTP_COOKIE");
std::cout << "012" << std::endl;
global.cookies = getenv("HTTP_COOKIE");
global.session = true;
// if request_has_cookie then
// pull sessionfile from sessiondir.
@ -51,8 +54,8 @@ namespace jet {
}
else if(contentType == "application/x-www-form-urlencoded")
global.setupFormURLEncoded(postdata);
// else if(contentType == "application/x-www-form-urlencoded")
// global.setupFormURLEncoded(postdata);
}
}
processContainer(container);

View File

@ -1,29 +1,5 @@
*** CGI VARIABLES ***
*** GLOBAL VARIABLES ***
=[xxx]
addition=[8]
complete=[ABCD;tohex]
division=[1.666666666667]
divisor=[8]
error=[64]
exprnumbers=[0123456789]
include=[yes]
ix=[1]
lefty=[01234]
modified1=[ABCD]
multiplication=[15]
nested=[64]
newname=[another container value]
noeval=[this is the value store in $[%name1].]
numbers=[0123456789]
subtraction=[2]
theexpr=[bcd]
thename=[this is the value store in .]
tohex=[tohex]
varname1=[vardata]
*** LOCAL VARIABLES ***
localvar=[This is a container set with '']
testinclude=[xThis is a container set with ''x]
*** KEYWORD VALUES ***
file=[./testinclude.jet]
name1=[]
sessiondir=[.]
*** COOKIES ***

View File

@ -2,4 +2,5 @@
export REQUEST_METHOD=POST
export CONTENT_LENGTH=619
export CONTENT_TYPE=multipart/form-data
export HTTP_COOKIE="session=18fd56a83f"
cat post.example.formdata | ./testpost.jet

View File

@ -1,13 +1,6 @@
#!../jet-2.0
<upload name="imagefiledata" path="images/%name" />
<jet cgi="true">
$[:name]
$[:name:1]
$[:name:2]
$[:name:3]
$[:name2]
$[:name:2;tohex]
$[:name:3;tohex]
$[:name2;tohex]
<dump file="/tmp/dump.txt" />
<jet sessiondir=".">
<dump file="./dump.txt" />
</jet>