mirror of https://github.com/nealey/eris.git
Fix if-modified-since test bug
This commit is contained in:
parent
a2179d8453
commit
7995aed5bb
2
eris.c
2
eris.c
|
@ -319,7 +319,7 @@ serve_file(int fd, char *filename, struct stat *st)
|
|||
badrequest(405, "Method Not Supported", "POST is not supported by this URL");
|
||||
}
|
||||
|
||||
if (st->st_mtime < ims) {
|
||||
if (st->st_mtime <= ims) {
|
||||
header(304, "Not Changed");
|
||||
eoh();
|
||||
return;
|
||||
|
|
4
test.sh
4
test.sh
|
@ -130,6 +130,10 @@ H "If-Modified-Since"
|
|||
title "Has been modified"
|
||||
printf 'GET / HTTP/1.0\r\nIf-Modified-Since: Sun, 27 Feb 1980 12:12:12 GMT\r\n\r\n' | $HTTPD 2>/dev/null | grep -q 'HTTP/1.. 200 ' && pass || fail
|
||||
|
||||
title "Exact same date"
|
||||
ims=$(printf 'GET / HTTP/1.0\r\n\r\n' | $HTTPD 2>/dev/null | awk -F ': ' '/Last-Modified/ {print $2;}')
|
||||
printf 'GET / HTTP/1.0\r\nIf-Modified-Since: %s\r\n\r\n' "$ims" | $HTTPD 2>/dev/null | grep -q 'HTTP/1.. 304 ' && pass || fail
|
||||
|
||||
title "RFC 822 Date"
|
||||
printf 'GET / HTTP/1.0\r\nIf-Modified-Since: Sun, 27 Feb 2030 12:12:12 GMT\r\n\r\n' | $HTTPD 2>/dev/null | grep -q 'HTTP/1.. 304 ' && pass || fail
|
||||
|
||||
|
|
Loading…
Reference in New Issue