forked from varnishcache/varnish-cache
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Proper handling of duplicate headers on IMS headers merge
This fixes a problem when a backend replies with 304 Not Modified (after a http conditional request from varnish) and does not supply a header that was duplicate in the cached object. Before this patch, varnish would only supply (by copying from the expired object) the first instance of a duplicate header.
- Loading branch information
1 parent
a50c99f
commit d6ed244
Showing
2 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
varnishtest "r01879: Check duplicate headers handling on IMS header merge" | ||
|
||
server s1 { | ||
rxreq | ||
txresp -hdr {etag: "foo"} -hdr "foo: a" -hdr "foo: b" -body "bdy" | ||
rxreq | ||
expect req.http.if-none-match == {"foo"} | ||
txresp -status 304 -hdr {etag: "foo"} -hdr "foo: c" -hdr "foo: d" | ||
rxreq | ||
txresp -hdr {etag: "bar"} -hdr "foo: a" -hdr "foo: b" -body "bdy" | ||
rxreq | ||
expect req.http.if-none-match == {"bar"} | ||
txresp -status 304 -hdr {etag: "bar"} | ||
} -start | ||
|
||
varnish v1 -vcl+backend { | ||
import std; | ||
|
||
sub vcl_backend_response { | ||
set beresp.ttl = 0.00001s; | ||
set beresp.grace = 0.1s; | ||
set beresp.keep = 9999s; | ||
} | ||
sub vcl_deliver { | ||
std.collect(resp.http.foo); | ||
} | ||
} -start | ||
|
||
client c1 { | ||
txreq | ||
rxresp | ||
expect resp.http.foo == "a, b" | ||
delay .5 | ||
txreq | ||
rxresp | ||
expect resp.http.foo == "c, d" | ||
delay .5 | ||
} -run | ||
|
||
client c2 { | ||
txreq | ||
rxresp | ||
expect resp.http.foo == "a, b" | ||
delay .5 | ||
txreq | ||
rxresp | ||
expect resp.http.foo == "a, b" | ||
} -run |