[master] 23de733 We used a wrong test to detect if a streaming pass could delete object data, and therefore also deleted when we should not.

Poul-Henning Kamp phk at varnish-cache.org
Wed Jun 1 15:44:39 CEST 2011


commit 23de733b2e4e25cec3e24962b2dfe40bb040ea14
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Jun 1 10:36:37 2011 +0000

    We used a wrong test to detect if a streaming pass could delete
    object data, and therefore also deleted when we should not.
    
    Fixes	#929

diff --git a/bin/varnishd/cache_response.c b/bin/varnishd/cache_response.c
index 407233b..4b4b46b 100644
--- a/bin/varnishd/cache_response.c
+++ b/bin/varnishd/cache_response.c
@@ -455,7 +455,8 @@ RES_StreamPoll(const struct sess *sp)
 	if (!(sp->wrk->res_mode & RES_GUNZIP))
 		(void)WRW_Flush(sp->wrk);
 
-	if (sp->objcore == NULL || (sp->objcore->flags & OC_F_PASS)) {
+	if (sp->obj->objcore == NULL ||
+	    (sp->obj->objcore->flags & OC_F_PASS)) {
 		/*
 		 * This is a pass object, release storage as soon as we
 		 * have delivered it.
diff --git a/bin/varnishtest/tests/r00929.vtc b/bin/varnishtest/tests/r00929.vtc
new file mode 100644
index 0000000..3b2f7ca
--- /dev/null
+++ b/bin/varnishtest/tests/r00929.vtc
@@ -0,0 +1,26 @@
+varnishtest "stream test"
+
+
+server s1 {
+	rxreq
+	txresp -bodylen 400
+} -start
+
+varnish v1 -vcl+backend {
+
+	sub vcl_fetch {
+		set beresp.do_stream = true;
+	}
+
+} -start
+
+client c1 {
+	txreq
+	rxresp
+	expect resp.bodylen == 400
+	txreq
+	rxresp
+	expect resp.bodylen == 400
+} -run
+
+
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 5c470d3..55228d5 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -243,7 +243,8 @@ cmd_http_expect(CMD_ARGS)
 			vtc_log(hp->vl, 4, "EXPECT %s (%s) %s %s (%s) match",
 			    av[0], lhs, av[1], av[2], rhs);
 	} else {
-		vtc_log(hp->vl, 0, "EXPECT %s (%s) %s %s (%s) not implemented",
+		vtc_log(hp->vl, 0,
+		    "EXPECT %s (%s) %s %s (%s) test not implemented",
 		    av[0], lhs, av[1], av[2], rhs);
 	}
 }



More information about the varnish-commit mailing list