Merge pull request #51 from jtanx/master
authorJeremy Tan <[email protected]>
Mon, 30 Sep 2013 07:25:34 +0000 (00:25 -0700)
committerJeremy Tan <[email protected]>
Mon, 30 Sep 2013 07:25:34 +0000 (00:25 -0700)
Cookie stuff and log path fixed

server-configs/nginx/fastcgi_params
server-configs/nginx/sites-enabled/mctxconfig
testing/cookie-test/readme.txt [new file with mode: 0644]
testing/cookie-test/test.c [new file with mode: 0644]

index 51aa692..b5b9858 100644 (file)
@@ -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;
index 1be361a..97e46b6 100644 (file)
@@ -81,13 +81,13 @@ server {
                }
 
                #Program log
-               location ^~ /api/log {
+               location = /api/log {
                        alias /var/log/mctxserv.log;
                        default_type text/plain;
                }
 
                #Program error log
-               location ^~ /api/errorlog {
+               location = /api/errorlog {
                        alias /var/log/mctxserv-error.log;
                        default_type text/plain;
                }
diff --git a/testing/cookie-test/readme.txt b/testing/cookie-test/readme.txt
new file mode 100644 (file)
index 0000000..fb52249
--- /dev/null
@@ -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 (file)
index 0000000..7f88239
--- /dev/null
@@ -0,0 +1,10 @@
+#include <fcgi_stdio.h>
+#include <stdlib.h>
+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"));
+       }
+}

UCC git Repository :: git.ucc.asn.au