changeset 1320:add5ae41969e

In FastCGI, signal 304 with a header, not the usual HTTP/1.1 line
author Adam Chlipala <adam@chlipala.net>
date Sat, 20 Nov 2010 09:48:03 -0500
parents c17e6144510b
children 4172863d049d
files include/urweb.h src/c/cgi.c src/c/fastcgi.c src/c/http.c src/c/request.c src/cjr_print.sml
diffstat 6 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/include/urweb.h	Fri Nov 19 17:06:11 2010 -0500
+++ b/include/urweb.h	Sat Nov 20 09:48:03 2010 -0500
@@ -286,4 +286,6 @@
 
 extern int uw_time_max;
 
+extern int uw_supports_direct_status;
+
 #endif
--- a/src/c/cgi.c	Fri Nov 19 17:06:11 2010 -0500
+++ b/src/c/cgi.c	Sat Nov 20 09:48:03 2010 -0500
@@ -137,3 +137,5 @@
 
 void uw_post_expunge(uw_context ctx, void *data) {
 }
+
+int uw_supports_direct_status = 1;
--- a/src/c/fastcgi.c	Fri Nov 19 17:06:11 2010 -0500
+++ b/src/c/fastcgi.c	Sat Nov 20 09:48:03 2010 -0500
@@ -618,3 +618,5 @@
 
 void uw_post_expunge(uw_context ctx, void *data) {
 }
+
+int uw_supports_direct_status = 0;
--- a/src/c/http.c	Fri Nov 19 17:06:11 2010 -0500
+++ b/src/c/http.c	Sat Nov 20 09:48:03 2010 -0500
@@ -358,3 +358,5 @@
 
 void uw_post_expunge(uw_context ctx, void *data) {
 }
+
+int uw_supports_direct_status = 1;
--- a/src/c/request.c	Fri Nov 19 17:06:11 2010 -0500
+++ b/src/c/request.c	Sat Nov 20 09:48:03 2010 -0500
@@ -211,7 +211,7 @@
     if (id && pass) {
       unsigned idn = atoi(id);
       uw_client_connect(idn, atoi(pass), sock, send, close, logger_data, log_error);
-      log_error(logger_data, "Processed request for messages by client %u\n\n", idn);
+      log_debug(logger_data, "Processed request for messages by client %u\n\n", idn);
       return KEEP_OPEN;
     }
     else {
--- a/src/cjr_print.sml	Fri Nov 19 17:06:11 2010 -0500
+++ b/src/cjr_print.sml	Sat Nov 20 09:48:03 2010 -0500
@@ -2924,7 +2924,7 @@
                   newline,
                   box [string "uw_clear_headers(ctx);",
                        newline,
-                       string "uw_write_header(ctx, \"HTTP/1.1 304 Not Modified\\r\\n\");",
+                       string "uw_write_header(ctx, uw_supports_direct_status ? \"HTTP/1.1 304 Not Modified\\r\\n\" : \"Status: 304 Not Modified\\r\\n\");",
                        newline,
                        string "return;",
                        newline],