From: Jeremy Tan Date: Mon, 30 Sep 2013 07:24:17 +0000 (+0800) Subject: Add cookie stuff X-Git-Url: https://git.ucc.asn.au/?p=matches%2FMCTX3420.git;a=commitdiff_plain;h=911cb352c2a2bd7fd6edf481a623440dd8f96b76 Add cookie stuff --- diff --git a/server-configs/nginx/fastcgi_params b/server-configs/nginx/fastcgi_params index 51aa692..b5b9858 100644 --- a/server-configs/nginx/fastcgi_params +++ b/server-configs/nginx/fastcgi_params @@ -2,6 +2,7 @@ fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; +fastcgi_param COOKIE_STRING $http_cookie; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_NAME $fastcgi_script_name; diff --git a/testing/cookie-test/readme.txt b/testing/cookie-test/readme.txt new file mode 100644 index 0000000..fb52249 --- /dev/null +++ b/testing/cookie-test/readme.txt @@ -0,0 +1,7 @@ +compile with: +gcc test.c -lfcgi -o test + +Run with: +spawn-fcgi -p9005 -n ./test + +nginx must be configured to pass $http_cookie as an evironment variable named COOKIE \ No newline at end of file diff --git a/testing/cookie-test/test.c b/testing/cookie-test/test.c new file mode 100644 index 0000000..7f88239 --- /dev/null +++ b/testing/cookie-test/test.c @@ -0,0 +1,10 @@ +#include +#include +int main() { + while (FCGI_Accept() >= 0) { + printf("Content-type: text\r\n"); + printf("Set-Cookie: name=value with spaces; and a semicolon\r\n"); + printf("Set-Cookie: name2=value2\r\n\r\n"); + printf("Cookie:%s\n", getenv("COOKIE_STRING")); + } +}