[master] f87c29b Push magic of ESI child delivery back home to esi_deliver.c

Poul-Henning Kamp phk at FreeBSD.org
Mon Oct 27 17:58:43 CET 2014


commit f87c29bdf69c81dcfc91b82fa8785f0ea0ed02e1
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Oct 27 16:58:15 2014 +0000

    Push magic of ESI child delivery back home to esi_deliver.c

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index dd2f71f..eaea802 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -1046,7 +1046,7 @@ char *VRT_StringList(char *d, unsigned dl, const char *p, va_list ap);
 void VRTPRIV_dynamic_kill(struct sess *sp, uintptr_t id);
 
 void ESI_Deliver(struct req *);
-void ESI_DeliverChild(struct req *);
+void ESI_DeliverChild(struct req *, struct busyobj *);
 
 /* cache_vrt_vmod.c */
 void VMOD_Init(void);
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index 0cb4713..deabbf6 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -215,8 +215,8 @@ ved_decode_len(uint8_t **pp)
  * the stream with a bit more overhead.
  */
 
-int __match_proto__(vdp_bytes)
-VED_pretend_gzip(struct req *req, enum vdp_action act, void **priv,
+static int __match_proto__(vdp_bytes)
+ved_pretend_gzip(struct req *req, enum vdp_action act, void **priv,
     const void *pv, ssize_t l)
 {
 	uint8_t buf1[5], buf2[5];
@@ -427,8 +427,8 @@ ESI_Deliver(struct req *req)
  * Include an object in a gzip'ed ESI object delivery
  */
 
-void
-ESI_DeliverChild(struct req *req)
+static void
+ved_stripgzip(struct req *req)
 {
 	ssize_t start, last, stop, lpad;
 	ssize_t l;
@@ -616,3 +616,26 @@ ESI_DeliverChild(struct req *req)
 	req->crc = crc32_combine(req->crc, icrc, ilen);
 	req->l_crc += ilen;
 }
+
+void
+ESI_DeliverChild(struct req *req, struct busyobj *bo)
+{
+	int i;
+
+	req->res_mode |= RES_ESI_CHILD;
+	i = ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED);
+	if (req->gzip_resp && i && !(req->res_mode & RES_ESI)) {
+		if (bo != NULL)
+			VBO_waitstate(bo, BOS_FINISHED);
+		ved_stripgzip(req);
+	} else {
+		if (req->gzip_resp && !i)
+			VDP_push(req, ved_pretend_gzip, NULL, 0);
+		else if (!req->gzip_resp && i)
+			VDP_push(req, VDP_gunzip, NULL, 0);
+
+		(void)VDP_DeliverObj(req);
+	}
+	(void)VDP_bytes(req, VDP_FLUSH, NULL, 0);
+	VDP_close(req);
+}
diff --git a/bin/varnishd/cache/cache_filter.h b/bin/varnishd/cache/cache_filter.h
index 859b1e5..e6d9274 100644
--- a/bin/varnishd/cache/cache_filter.h
+++ b/bin/varnishd/cache/cache_filter.h
@@ -111,5 +111,3 @@ void VDP_close(struct req *req);
 enum objiter_status VDP_DeliverObj(struct req *req);
 
 vdp_bytes VDP_gunzip;
-vdp_bytes VED_pretend_gzip;
-
diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c
index 32bf944..0836f0e 100644
--- a/bin/varnishd/http1/cache_http1_deliver.c
+++ b/bin/varnishd/http1/cache_http1_deliver.c
@@ -195,7 +195,6 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
 {
 	const char *r;
 	enum objiter_status ois;
-	int i;
 
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC);
@@ -207,22 +206,7 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
 		req->res_mode |= RES_ESI;
 
 	if (req->esi_level > 0) {
-		req->res_mode |= RES_ESI_CHILD;
-		i = ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED);
-		if (req->gzip_resp && i && !(req->res_mode & RES_ESI)) {
-			if (bo != NULL)
-				VBO_waitstate(bo, BOS_FINISHED);
-			ESI_DeliverChild(req);
-		} else {
-			if (req->gzip_resp && !i)
-				VDP_push(req, VED_pretend_gzip, NULL, 0);
-			else if (!req->gzip_resp && i)
-				VDP_push(req, VDP_gunzip, NULL, 0);
-
-			(void)VDP_DeliverObj(req);
-		}
-		(void)VDP_bytes(req, VDP_FLUSH, NULL, 0);
-		VDP_close(req);
+		ESI_DeliverChild(req, bo);
 		return;
 	}
 



More information about the varnish-commit mailing list