[master] c7e3738 Only do CRC calculation once.

Poul-Henning Kamp phk at varnish-cache.org
Thu Mar 31 19:44:33 CEST 2011


commit c7e373808971c3814d159df89b8a42b06f6a235a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Mar 31 17:44:22 2011 +0000

    Only do CRC calculation once.

diff --git a/bin/varnishd/cache_esi_deliver.c b/bin/varnishd/cache_esi_deliver.c
index 71bbb4b..b666c79 100644
--- a/bin/varnishd/cache_esi_deliver.c
+++ b/bin/varnishd/cache_esi_deliver.c
@@ -297,6 +297,11 @@ ESI_Deliver(struct sess *sp)
 				l_icrc = ved_decode_len(&p);
 				icrc = vbe32dec(p);
 				p += 4;
+				if (sp->wrk->gzip_resp) {
+					sp->wrk->crc = crc32_combine(
+					    sp->wrk->crc, icrc, l_icrc);
+					sp->wrk->l_crc += l_icrc;
+				}
 			}
 			/*
 			 * There is no guarantee that the 'l' bytes are all
@@ -314,9 +319,6 @@ ESI_Deliver(struct sess *sp)
 					 * We have a gzip'ed VEC and delivers
 					 * a gzip'ed ESI response.
 					 */
-					sp->wrk->crc = crc32_combine(
-					    sp->wrk->crc, icrc, l_icrc);
-					sp->wrk->l_crc += l_icrc;
 					WRW_Write(sp->wrk, st->ptr + off, l2);
 				} else if (sp->wrk->gzip_resp) {
 					/*



More information about the varnish-commit mailing list