Commit 66c8c9c3 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Treat RFC-illegal negative (s-)max-age values as zero.

Fixes	#887
parent cd434659
......@@ -112,7 +112,10 @@ RFC2616_Ttl(const struct sess *sp)
http_GetHdrField(hp, H_Cache_Control, "max-age", &p)) &&
p != NULL) {
max_age = strtoul(p, NULL, 0);
if (*p == '-')
max_age = 0;
else
max_age = strtoul(p, NULL, 0);
if (http_GetHdr(hp, H_Age, &p)) {
age = strtoul(p, NULL, 0);
sp->wrk->age = age;
......
# $Id$
test "Ticket #887"
server s1 {
rxreq
txresp -hdr "Cache-control: max-age=-1000" -body "FOO"
rxreq
txresp -body "FOOBAR"
} -start
varnish v1 -vcl+backend {
} -start
client c1 {
txreq
rxresp
expect resp.bodylen == 3
txreq
rxresp
expect resp.bodylen == 6
} -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment