Find attached proposed fix and test case for #979

Regards,
Martin

-- 
Martin Blix Grydeland
Varnish Software AS
commit 8f731bd32fd1eb5d847b59b20666e8ee1e4568fb
Author: Martin Blix Grydeland <[email protected]>
Date:   Tue Aug 16 23:55:02 2011 +0200

    Always clear sp->wrk->h_content_length on restart in vcl_deliver
    
    Fixes: #979

diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 0527743..4a9e63a 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -233,6 +233,7 @@ cnt_prepresp(struct sess *sp)
 		AZ(sp->obj);
 		sp->restarts++;
 		sp->director = NULL;
+		sp->wrk->h_content_length = NULL;
 		http_Setup(sp->wrk->bereq, NULL);
 		http_Setup(sp->wrk->beresp, NULL);
 		http_Setup(sp->wrk->resp, NULL);
diff --git a/bin/varnishtest/tests/r00979.vtc b/bin/varnishtest/tests/r00979.vtc
new file mode 100644
index 0000000..bc72efc
--- /dev/null
+++ b/bin/varnishtest/tests/r00979.vtc
@@ -0,0 +1,29 @@
+varnishtest "r00979.vtc Test restart when do_stream in vcl_deliver"
+
+server s1 {
+	rxreq
+	txresp -status 200 -body "1"
+	expect_close
+
+	accept
+	rxreq
+	txresp -status 200 -body "11"
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_fetch {
+		set beresp.do_stream = true;
+	}
+	sub vcl_deliver {
+		if (req.restarts == 0) {
+			return (restart);
+		}
+	}
+} -start
+
+client c1 {
+	txreq
+	rxresp
+	expect resp.status == 200
+	expect resp.bodylen == 2
+} -run
_______________________________________________
varnish-dev mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

Reply via email to