[master] de91486 Add explanation for not streaming

Poul-Henning Kamp phk at FreeBSD.org
Fri May 15 00:10:09 CEST 2015


commit de9148622abcc226725a36291ac8f5dd88266c09
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu May 14 21:45:56 2015 +0000

    Add explanation for not streaming

diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index c8865c2..9aeba38 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -466,10 +466,25 @@ ved_pretend_gzip(struct req *req, enum vdp_action act, void **priv,
 
 /*---------------------------------------------------------------------
  * Include an object in a gzip'ed ESI object delivery
+ *
+ * This is not written as a VDP (yet) because it relies on the
+ * OA_GZIPBITS which only becomes available when the input side
+ * has fully digested the object and located the magic bit positions.
+ *
+ * We can improve this two ways.
+ *
+ * One is to run a gunzip instance here, to find the stopbit ourselves,
+ * but that would be double work, in particular when passing a gziped
+ * object, where we would have two null-gunzips.
+ *
+ * The other is to have the input side guarantee that OA_GZIPBITS::stopbit
+ * always is committed before the chunk of data containing it.  We would
+ * be required to poll OA_GZIPBITS on every chunk presented, but that is
+ * much cheaper than running a gunzip instance.
  */
 
 static void
-ved_stripgzip(struct req *req)
+ved_stripgzip(struct req *req, struct busyobj *bo)
 {
 	ssize_t start, last, stop, lpad;
 	ssize_t l;
@@ -490,6 +505,9 @@ ved_stripgzip(struct req *req)
 	CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC);
 	CAST_OBJ_NOTNULL(ecx, req->transport_priv, ECX_MAGIC);
 
+	if (bo != NULL)
+		VBO_waitstate(bo, BOS_FINISHED);
+
 	AN(ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED));
 
 	/*
@@ -699,9 +717,7 @@ VED_Deliver(struct req *req, struct busyobj *bo)
 	req->res_mode |= RES_ESI_CHILD;
 	i = ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED);
 	if (ecx->isgzip && i && !(req->res_mode & RES_ESI)) {
-		if (bo != NULL)
-			VBO_waitstate(bo, BOS_FINISHED);
-		ved_stripgzip(req);
+		ved_stripgzip(req, bo);
 	} else {
 		if (ecx->isgzip && !i)
 			VDP_push(req, ved_pretend_gzip, ecx, 1);



More information about the varnish-commit mailing list