diff --git a/eris.c b/eris.c index 5e56b46..b25a62a 100644 --- a/eris.c +++ b/eris.c @@ -181,7 +181,7 @@ not_found() header(404, "Not Found"); printf("Content-Type: text/html\r\n"); - printf("Content-Length: %d\r\n", sizeof msg); + printf("Content-Length: %lu\r\n", sizeof msg); printf("\r\n"); printf("%s\n", msg); /* sizeof msg includes the NULL */ dolog(404, sizeof msg); @@ -541,7 +541,7 @@ handle_request() badrequest(505, "Version Not Supported", "HTTP/0.9 not supported"); case '?': query_string = p + 1; - break; + continue; case '.': if (p[-1] == '/') { c = ':'; diff --git a/test.sh b/test.sh index 0e75506..084b0e6 100755 --- a/test.sh +++ b/test.sh @@ -127,7 +127,7 @@ title "Basic CGI" printf 'GET /a.cgi HTTP/1.0\r\n\r\n' | $HTTPD_CGI 2>/dev/null | d | grep -q 'HTTP/1.0 200 OK#%Server: .*#%Connection: close#%Pragma: no-cache#%Content-type: text/plain#%#%james%' && pass || fail title "GET with arguments" -printf 'GET /a.cgi?foo HTTP/1.0\r\n\r\n' | $HTTPD_CGI 2>/dev/null | d | grep -q 'HTTP/1.0 200 OK#%Server: .*#%Pragma: no-cache#%Connection: close#%Content-type: text/plain#%#%foo%' && pass || fail +printf 'GET /a.cgi?foo HTTP/1.0\r\n\r\n' | $HTTPD_CGI 2>/dev/null | d | grep -q 'HTTP/1.0 200 OK#%Server: .*#%Connection: close#%Pragma: no-cache#%Content-type: text/plain#%#%foo%' && pass || fail title "POST" printf 'POST /a.cgi HTTP/1.0\r\nContent-Type: moo\r\nContent-Length: 3\r\n\r\narf' | $HTTPD_CGI 2>/dev/null | d | grep -q 't:moo%v:arf$' && pass || fail