Commit dbbb1fb2 authored by Nils Goroll's avatar Nils Goroll

keep Content-Encoding intact if http_gzip_support is disabled

Fixes #2610
parent 6b8e44ff
......@@ -521,6 +521,11 @@ vbf_figure_out_vfp(struct busyobj *bo)
*
*/
if (! cache_param->http_gzip_support) {
bo->do_gzip = bo->do_gunzip = 0;
return (0);
}
if (http_GetStatus(bo->beresp) == 206) {
if (bo->do_esi) {
VSLb(bo->vsl, SLT_VCL_Error,
......@@ -531,10 +536,9 @@ vbf_figure_out_vfp(struct busyobj *bo)
return (0);
}
/* No body or no GZIP support -> done */
/* No body -> done */
if (bo->htc->body_status == BS_NONE ||
bo->htc->content_length == 0 ||
!cache_param->http_gzip_support) {
bo->htc->content_length == 0) {
http_Unset(bo->beresp, H_Content_Encoding);
bo->do_gzip = bo->do_gunzip = 0;
bo->do_stream = 0;
......
......@@ -15,6 +15,18 @@ server s1 {
expect req.url == "/foobar"
expect req.http.accept-encoding == "gzip"
txresp -bodylen 43
rxreq
expect req.url == "/nogzip"
expect req.http.accept-encoding == "gzip"
txresp -hdr "Vary: Accept-Encoding" \
-gzipbody "keep gzip real"
rxreq
expect req.url == "/nogzip"
expect req.http.accept-encoding == <undef>
txresp -hdr "Vary: Accept-Encoding" \
-body "keep plain real"
} -start
varnish v1 -cliok "param.set http_gzip_support true" -vcl+backend {
......@@ -53,3 +65,18 @@ client c1 {
varnish v1 -expect n_gzip == 1
varnish v1 -expect n_gunzip == 2
varnish v1 -expect n_test_gunzip == 0
varnish v1 -cliok "param.set http_gzip_support false"
client c1 {
txreq -url /nogzip -hdr "Accept-Encoding: gzip"
rxresp
expect resp.http.content-encoding == "gzip"
gunzip
expect resp.body == "keep gzip real"
txreq -url /nogzip
rxresp
expect resp.http.content-encoding == <undef>
expect resp.body == "keep plain real"
} -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