[3.0] 8c821b7 Don't consider pass an error when doing streaming fetch.

Martin Blix Grydeland martin at varnish-cache.org
Wed Jun 20 13:58:09 CEST 2012


commit 8c821b77b3ecda5ced37a35ab64bddd1b7f1caf2
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Wed Jun 20 13:56:57 2012 +0200

    Don't consider pass an error when doing streaming fetch.
    
    Patch by: tnt

diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 23183ed..ea0a961 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -930,13 +930,13 @@ cnt_streambody(struct sess *sp)
 	AZ(sp->vbc);
 	AN(sp->director);
 
-	if (!i && sp->obj->objcore != NULL) {
+	if (i)
+		sp->doclose = "Stream error";
+	else if (sp->obj->objcore != NULL) {
 		EXP_Insert(sp->obj);
 		AN(sp->obj->objcore);
 		AN(sp->obj->objcore->ban);
 		HSH_Unbusy(sp);
-	} else {
-		sp->doclose = "Stream error";
 	}
 	sp->wrk->acct_tmp.fetch++;
 	sp->director = NULL;
diff --git a/bin/varnishtest/tests/r01157.vtc b/bin/varnishtest/tests/r01157.vtc
new file mode 100644
index 0000000..9cecd9a
--- /dev/null
+++ b/bin/varnishtest/tests/r01157.vtc
@@ -0,0 +1,26 @@
+varnishtest "#1157 - Connection close on pass and do_stream"
+
+server s1 {
+	rxreq
+	txresp
+	expect req.url == "/"
+
+	rxreq
+	txresp
+	expect req.url == "/"
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_recv { return (pass); }
+	sub vcl_fetch {	set beresp.do_stream = true; }
+} -start
+
+client c1 {
+	txreq -url /
+	rxresp
+	expect resp.status == 200
+
+	txreq -url /
+	rxresp
+	expect resp.status == 200
+} -run



More information about the varnish-commit mailing list