Browse Source

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 14 years ago
parent
commit
f67cdb67df
  1. 1
      NEWS
  2. 5
      src/request.c
  3. 8
      tests/request.t

1
NEWS

@ -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)

5
src/request.c

@ -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 */
}

8
tests/request.t

@ -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" );

Loading…
Cancel
Save