mirror of https://github.com/nealey/eris.git
Fix if-modified-since bug, update test.sh
This commit is contained in:
parent
ef9e02251d
commit
dcb83f3e47
4
eris.c
4
eris.c
|
@ -98,7 +98,7 @@ int http_version;
|
||||||
char *content_type;
|
char *content_type;
|
||||||
size_t content_length;
|
size_t content_length;
|
||||||
off_t range_start, range_end;
|
off_t range_start, range_end;
|
||||||
time_t ims = 0;
|
time_t ims;
|
||||||
|
|
||||||
|
|
||||||
#define BUFFER_SIZE 8192
|
#define BUFFER_SIZE 8192
|
||||||
|
@ -512,6 +512,7 @@ handle_request()
|
||||||
char buf[MAXHEADERLEN];
|
char buf[MAXHEADERLEN];
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
/* Initialize globals */
|
||||||
host = NULL;
|
host = NULL;
|
||||||
user_agent = NULL;
|
user_agent = NULL;
|
||||||
refer = NULL;
|
refer = NULL;
|
||||||
|
@ -520,6 +521,7 @@ handle_request()
|
||||||
range_end = 0;
|
range_end = 0;
|
||||||
content_type = NULL;
|
content_type = NULL;
|
||||||
content_length = 0;
|
content_length = 0;
|
||||||
|
ims = 0;
|
||||||
|
|
||||||
alarm(READTIMEOUT);
|
alarm(READTIMEOUT);
|
||||||
|
|
||||||
|
|
11
test.sh
11
test.sh
|
@ -98,11 +98,15 @@ printf 'GET /empty HTTP/1.0\r\n\r\n' | $HTTPD 2>/dev/null | d | grep -q '301 Red
|
||||||
|
|
||||||
title "Logging /"
|
title "Logging /"
|
||||||
(printf 'GET / HTTP/1.1\r\nHost: host\r\n\r\n' |
|
(printf 'GET / HTTP/1.1\r\nHost: host\r\n\r\n' |
|
||||||
PROTO=TCP TCPREMOTEPORT=1234 TCPREMOTEIP=10.0.0.2 $HTTPD >/dev/null) 2>&1 | grep -q '^10.0.0.2 200 6 host (null) (null) /$' && pass || fail
|
PROTO=TCP TCPREMOTEPORT=1234 TCPREMOTEIP=10.0.0.2 $HTTPD >/dev/null) 2>&1 | grep -q '^10.0.0.2:1234 200 6 host (null) (null) /$' && pass || fail
|
||||||
|
|
||||||
title "Logging /index.html"
|
title "Logging /index.html"
|
||||||
(printf 'GET /index.html HTTP/1.1\r\nHost: host\r\n\r\n' |
|
(printf 'GET /index.html HTTP/1.1\r\nHost: host\r\n\r\n' |
|
||||||
PROTO=TCP TCPREMOTEPORT=1234 TCPREMOTEIP=10.0.0.2 $HTTPD >/dev/null) 2>&1 | grep -q '^10.0.0.2 200 6 host (null) (null) /index.html$' && pass || fail
|
PROTO=TCP TCPREMOTEPORT=1234 TCPREMOTEIP=10.0.0.2 $HTTPD >/dev/null) 2>&1 | grep -q '^10.0.0.2:1234 200 6 host (null) (null) /index.html$' && pass || fail
|
||||||
|
|
||||||
|
title "Logging busybox"
|
||||||
|
(printf 'GET /index.html HTTP/1.1\r\nHost: host\r\n\r\n' |
|
||||||
|
PROTO=TCP TCPREMOTEADDR=[::1]:8765 $HTTPD >/dev/null) 2>&1 | grep -Fxq '[::1]:8765 200 6 host (null) (null) /index.html' && pass || fail
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,6 +149,9 @@ printf 'GET / HTTP/1.0\r\nIf-Modified-Since: Thursday, 27-Feb-30 12:12:12 GMT\r\
|
||||||
title "ANSI C Date"
|
title "ANSI C Date"
|
||||||
printf 'GET / HTTP/1.0\r\nIf-Modified-Since: Sun Feb 27 12:12:12 2030\r\n\r\n' | $HTTPD 2>/dev/null | grep -q 'HTTP/1.. 304 ' && pass || fail
|
printf 'GET / HTTP/1.0\r\nIf-Modified-Since: Sun Feb 27 12:12:12 2030\r\n\r\n' | $HTTPD 2>/dev/null | grep -q 'HTTP/1.. 304 ' && pass || fail
|
||||||
|
|
||||||
|
title "ims persist"
|
||||||
|
printf 'GET / HTTP/1.0\r\nIf-Modified-Since: %s\r\n\r\nGET / HTTP/1.0\r\n\r\n' | $HTTPD 2>/dev/null | d | grep -q 'HTTP/1.. 304.*HTTP/1.. 200'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
H "Directory indexing"
|
H "Directory indexing"
|
||||||
|
|
Loading…
Reference in New Issue