[master] 911194b Collect code for increased clarity

Poul-Henning Kamp phk at FreeBSD.org
Tue Feb 25 12:33:25 CET 2014


commit 911194b2d03a57637b7ce4fb00dd6479f21e7703
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Feb 24 14:08:55 2014 +0000

    Collect code for increased clarity

diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 5b89bf1..890b247 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -422,21 +422,19 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
 	if (bo->do_gunzip && !bo->is_gzip)
 		bo->do_gunzip = 0;
 
-	/* If we do gunzip, remove the C-E header */
-	if (bo->do_gunzip)
-		http_Unset(bo->beresp, H_Content_Encoding);
-
 	/* We wont gzip unless it is ungziped */
 	if (bo->do_gzip && !bo->is_gunzip)
 		bo->do_gzip = 0;
 
-	/* If we do gzip, add the C-E header */
-	if (bo->do_gzip)
-		http_SetHeader(bo->beresp, "Content-Encoding: gzip");
-
 	/* But we can't do both at the same time */
 	assert(bo->do_gzip == 0 || bo->do_gunzip == 0);
 
+	/* Fix Content-Encoding, as appropriate */
+	if (bo->do_gzip)
+		http_SetHeader(bo->beresp, "Content-Encoding: gzip");
+	else if (bo->do_gunzip)
+		http_Unset(bo->beresp, H_Content_Encoding);
+
 	AN(bo->vbc);
 	est = V1F_Setup_Fetch(bo);
 



More information about the varnish-commit mailing list