summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2009-06-11 10:18:36 +0000
committerStefan Bühler <stbuehler@web.de>2009-06-11 10:18:36 +0000
commit3af67d139238081356a1542f3eeb68ef6fd5fd3d (patch)
treef4786248a587e017356cedaf197783f3e1fd91a2
parent5204fd7e6c8006750ada3d3295972a18b2b5dcd6 (diff)
downloadlighttpd-git-3af67d139238081356a1542f3eeb68ef6fd5fd3d.tar.gz
Ignore multiple "If-None-Match" headers (only use first one, fixes #753)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2528 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r--NEWS1
-rw-r--r--src/request.c14
-rwxr-xr-xtests/request.t2
3 files changed, 4 insertions, 13 deletions
diff --git a/NEWS b/NEWS
index 5f23dde5..0c3d017c 100644
--- a/NEWS
+++ b/NEWS
@@ -52,6 +52,7 @@ NEWS
* Add ssi.content-type option (default text/html, fixes #615)
* Add support for "real" entropy from /dev/[u]random (fixes #1977)
* Adding support for additional chars in LDAP usernames (fixes #1941)
+ * Ignore multiple "If-None-Match" headers (only use first one, fixes #753)
- 1.4.22 - 2009-03-07
* Fix wrong lua type for CACHE_MISS/CACHE_HIT in mod_cml (fixes #533)
diff --git a/src/request.c b/src/request.c
index 9a2c7211..c5762e40 100644
--- a/src/request.c
+++ b/src/request.c
@@ -956,18 +956,8 @@ int http_request_parse(server *srv, connection *con) {
if (!con->request.http_if_none_match) {
con->request.http_if_none_match = ds->value->ptr;
} else {
- con->http_status = 400;
- con->keep_alive = 0;
-
- if (srv->srvconf.log_request_header_on_error) {
- log_error_write(srv, __FILE__, __LINE__, "s",
- "duplicate If-None-Match-header -> 400");
- log_error_write(srv, __FILE__, __LINE__, "Sb",
- "request-header:\n",
- con->request.request);
- }
- array_insert_unique(con->request.headers, (data_unset *)ds);
- return 0;
+ ds->free((data_unset*) ds);
+ ds = NULL;
}
} else if (cmp > 0 && 0 == (cmp = buffer_caseless_compare(CONST_BUF_LEN(ds->key), CONST_STR_LEN("Range")))) {
if (!con->request.http_range) {
diff --git a/tests/request.t b/tests/request.t
index ab4f2d2c..0a35f571 100755
--- a/tests/request.t
+++ b/tests/request.t
@@ -280,7 +280,7 @@ If-None-Match: 5
If-None-Match: 4
EOF
);
-$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
ok($tf->handle_http($t) == 0, 'Duplicate If-None-Match headers');
$t->{REQUEST} = ( <<EOF