diff --git a/__dump.cpp b/__dump.cpp index 18c1942..fe941a3 100644 --- a/__dump.cpp +++ b/__dump.cpp @@ -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(); } diff --git a/__jet.cpp b/__jet.cpp index 4604350..aedaa32 100644 --- a/__jet.cpp +++ b/__jet.cpp @@ -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); diff --git a/tests/dump.txt b/tests/dump.txt index 971245e..da96938 100644 --- a/tests/dump.txt +++ b/tests/dump.txt @@ -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 *** diff --git a/tests/posttest.sh b/tests/posttest.sh index f212bcc..8c2911b 100755 --- a/tests/posttest.sh +++ b/tests/posttest.sh @@ -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 diff --git a/tests/testpost.jet b/tests/testpost.jet index b18ca64..1e7b416 100755 --- a/tests/testpost.jet +++ b/tests/testpost.jet @@ -1,13 +1,6 @@ #!../jet-2.0 - -$[:name] -$[:name:1] -$[:name:2] -$[:name:3] -$[:name2] -$[:name:2;tohex] -$[:name:3;tohex] -$[:name2;tohex] - + + +