fixed handling of duplicate If-Modified-Since to return 304

- don't append the second string to the first, but free it instead


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1947 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.17
Jan Kneschke 2007-08-18 11:14:12 +00:00
parent 5bc539b63e
commit f67cdb67df
3 changed files with 9 additions and 5 deletions

1
NEWS
View File

@ -19,6 +19,7 @@ NEWS
* fixed too aggresive caching of nested conditionals (#41)
* fixed possible overflow in unix-socket path checks on BSD (#713)
* fixed extra Content-Length header on 1xx, 204 and 304 (#1002)
* fixed handling of duplicate If-Modified-Since to return 304
* removed config-check if passwd files exist (#1188)

View File

@ -922,6 +922,9 @@ int http_request_parse(server *srv, connection *con) {
} else if (0 == strcasecmp(con->request.http_if_modified_since,
ds->value->ptr)) {
/* ignore it if they are the same */
ds->free((data_unset *)ds);
ds = NULL;
} else {
con->http_status = 400;
con->keep_alive = 0;
@ -977,7 +980,7 @@ int http_request_parse(server *srv, connection *con) {
}
}
array_insert_unique(con->request.headers, (data_unset *)ds);
if (ds) array_insert_unique(con->request.headers, (data_unset *)ds);
} else {
/* empty header-fields are not allowed by HTTP-RFC, we just ignore them */
}

View File

@ -339,12 +339,12 @@ $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
ok($tf->handle_http($t) == 0, 'HEAD with Content-Length');
$t->{REQUEST} = ( <<EOF
GET / HTTP/1.0
If-Modified-Since: Sun, 1970 Jan 01 00:00:01 GMT
If-Modified-Since: Sun, 1970 Jan 01 00:00:01 GMT
GET /index.html HTTP/1.0
If-Modified-Since: Sun, 01 Jan 2100 00:00:02 GMT
If-Modified-Since: Sun, 01 Jan 2100 00:00:02 GMT
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ];
ok($tf->handle_http($t) == 0, 'Duplicate If-Mod-Since, with equal timestamps');
$t->{REQUEST} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: \0\r\n\r\n" );