[master] e09ed9d Use the pretend_gzip to simplify delivery of esi objects
Poul-Henning Kamp
phk at FreeBSD.org
Fri Oct 24 00:42:01 CEST 2014
commit e09ed9d8f404f8c691fa168d04c1601a9709397b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Thu Oct 23 22:41:35 2014 +0000
Use the pretend_gzip to simplify delivery of esi objects
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index 35fdeaa..9eb10e3 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -362,22 +362,7 @@ ESI_Deliver(struct req *req)
sl -= l2;
l -= l2;
- if (req->gzip_resp && isgzip) {
- /*
- * We have a gzip'ed VEC and delivers
- * a gzip'ed ESI response.
- */
- (void)VDP_bytes(req, VDP_NULL, pp, l2);
- } else if (req->gzip_resp) {
- /*
- * A gzip'ed ESI response, but the VEC
- * was not gzip'ed.
- */
- (void)VED_pretend_gzip(req, VDP_NULL,
- NULL, pp, l2);
- } else {
- (void)VDP_bytes(req, VDP_NULL, pp, l2);
- }
+ (void)VDP_bytes(req, VDP_NULL, pp, l2);
pp += l2;
if (sl == 0) {
ois = ObjIter(req->objcore, oi,
diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c
index 8d479a9..26fae72 100644
--- a/bin/varnishd/http1/cache_http1_deliver.c
+++ b/bin/varnishd/http1/cache_http1_deliver.c
@@ -341,31 +341,32 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
ois = OIS_DONE;
if (!req->wantbody) {
/* This was a HEAD or conditional request */
- } else if (req->res_mode & RES_ESI) {
- if (req->esi_level == 0 && req->res_mode & RES_GUNZIP)
- VDP_push(req, VDP_gunzip, NULL);
- ESI_Deliver(req);
- } else if (req->res_mode & RES_ESI_CHILD) {
+ } else if (req->esi_level > 0) {
if (req->gzip_resp &&
- !ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED)) {
- VDP_push(req, VED_pretend_gzip, NULL);
- ois = v1d_WriteDirObj(req);
- } else if (req->gzip_resp) {
+ ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED)) {
if (bo != NULL)
VBO_waitstate(bo, BOS_FINISHED);
ESI_DeliverChild(req);
- } else if (!req->gzip_resp &&
- ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED)) {
- VDP_push(req, VDP_gunzip, NULL);
- ois = v1d_WriteDirObj(req);
} else {
- /* The toplevel will gunzip if needed */
- ois = v1d_WriteDirObj(req);
+ if (req->gzip_resp &&
+ !ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED))
+ VDP_push(req, VED_pretend_gzip, NULL);
+ else if (!req->gzip_resp &&
+ ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED))
+ VDP_push(req, VDP_gunzip, NULL);
+
+ if (req->res_mode & RES_ESI)
+ ESI_Deliver(req);
+ else
+ ois = v1d_WriteDirObj(req);
}
} else {
if (req->res_mode & RES_GUNZIP)
VDP_push(req, VDP_gunzip, NULL);
- ois = v1d_WriteDirObj(req);
+ if (req->res_mode & RES_ESI)
+ ESI_Deliver(req);
+ else
+ ois = v1d_WriteDirObj(req);
}
(void)VDP_bytes(req, VDP_FLUSH, NULL, 0);
More information about the varnish-commit
mailing list