Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
66ad64fe
Commit
66ad64fe
authored
Nov 21, 2019
by
Dag Haavi Finstad
Committed by
Reza Naghibi
May 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure we don't override Content-Encoding in a 304 conditional fetch
Test inspired by Carlos Abalde
parent
4763c778
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
1 deletion
+62
-1
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+1
-1
r03169.vtc
bin/varnishtest/tests/r03169.vtc
+61
-0
No files found.
bin/varnishd/cache/cache_fetch.c
View file @
66ad64fe
...
...
@@ -267,9 +267,9 @@ vbf_304_logic(struct busyobj *bo)
* the IMS fetch, and we must weaken any
* new ETag we get.
*/
http_Unset
(
bo
->
beresp
,
H_Content_Encoding
);
RFC2616_Weaken_Etag
(
bo
->
beresp
);
}
http_Unset
(
bo
->
beresp
,
H_Content_Encoding
);
http_Unset
(
bo
->
beresp
,
H_Content_Length
);
HTTP_Merge
(
bo
->
wrk
,
bo
->
stale_oc
,
bo
->
beresp
);
assert
(
http_IsStatus
(
bo
->
beresp
,
200
));
...
...
bin/varnishtest/tests/r03169.vtc
0 → 100644
View file @
66ad64fe
varnishtest "Ensure we don't override Content-Encoding on a cond fetch"
server s1 {
rxreq
txresp -hdr {ETag: "foo"} -body {****}
rxreq
expect req.http.If-None-Match == {"foo"}
txresp -status 304 -hdr {ETag: W/"foo"} -hdr "Content-Encoding: gzip"
rxreq
expect req.url == "/1"
txresp -hdr {Etag: "bar"} -gzipbody {asdf}
rxreq
expect req.url == "/1"
expect req.http.If-None-Match == {"bar"}
txresp -status 304
} -start
varnish v1 -vcl+backend {
sub vcl_backend_response {
set beresp.ttl = 1s;
set beresp.grace = 0s;
set beresp.keep = 1d;
}
} -start
client c1 {
txreq -hdr "Accept-Encoding: gzip"
rxresp
expect resp.status == 200
expect resp.http.ETag == {"foo"}
expect resp.http.Content-Length == "4"
expect resp.http.Content-Encoding == <undef>
delay 1.5
txreq -hdr "Accept-Encoding: gzip"
rxresp
expect resp.status == 200
expect resp.http.ETag == {W/"foo"}
expect resp.http.Content-Length == "4"
expect resp.http.Content-Encoding == <undef>
# Also check that we're still OK in the general case
txreq -url "/1" -hdr "Accept-Encoding: gzip"
rxresp
expect resp.status == 200
expect resp.http.ETag == {"bar"}
expect resp.http.Content-Encoding == "gzip"
delay 1.5
txreq -url "/1" -hdr "Accept-Encoding: gzip"
rxresp
expect resp.status == 200
expect resp.http.ETag == {"bar"}
expect resp.http.Content-Encoding == "gzip"
} -run
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment