[master] 0c80b0a Normalize requests Accept-Encoding header if we are not pipe or pass after vcl_recv{}. This is necessary to get consistent Vary: header processing.

Poul-Henning Kamp phk at varnish-cache.org
Mon Jan 24 11:17:42 CET 2011


commit 0c80b0a675c4fcf307a31ce3849e3de28beff568
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jan 24 10:16:58 2011 +0000

    Normalize requests Accept-Encoding header if we are not pipe or pass
    after vcl_recv{}.  This is necessary to get consistent Vary: header
    processing.

diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 9ec86fa..31adc80 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -1168,6 +1168,18 @@ cnt_recv(struct sess *sp)
 		return (0);
 	}
 
+	if (params->http_gzip_support &&
+	     (recv_handling != VCL_RET_PIPE) &&
+	     (recv_handling != VCL_RET_PASS)) {
+		if (RFC2616_Req_Gzip(sp)) {
+			http_Unset(sp->http, H_Accept_Encoding);
+			http_PrintfHeader(sp->wrk, sp->fd, sp->http,
+			    "Accept-Encoding: gzip");
+		} else {
+			http_Unset(sp->http, H_Accept_Encoding);
+		}
+	}
+
 	SHA256_Init(sp->wrk->sha256ctx);
 	VCL_hash_method(sp);
 	assert(sp->handling == VCL_RET_HASH);



More information about the varnish-commit mailing list