[master] 32d0751 Reset the "must close" flag when we close the backend connection before a retry.
Poul-Henning Kamp
phk at FreeBSD.org
Mon May 12 18:01:33 CEST 2014
commit 32d0751bc19f3725e291e46b95ff33e1882a291e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon May 12 16:00:59 2014 +0000
Reset the "must close" flag when we close the backend connection
before a retry.
Fixes #1494
Testcase by: scoof
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index f8e2848..0f49a3b 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -371,6 +371,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
if (wrk->handling == VCL_RET_RETRY) {
AN (bo->vbc);
VDI_CloseFd(&bo->vbc, &bo->acct);
+ bo->should_close = 0;
bo->retries++;
if (bo->retries <= cache_param->max_retries)
return (F_STP_RETRY);
diff --git a/bin/varnishtest/tests/r01494.vtc b/bin/varnishtest/tests/r01494.vtc
new file mode 100644
index 0000000..38880c5
--- /dev/null
+++ b/bin/varnishtest/tests/r01494.vtc
@@ -0,0 +1,27 @@
+varnishtest "Test retry in be_resp w/conn: close"
+
+server s1 {
+ rxreq
+ txresp -hdr "Connection: close" -bodylen 3
+ expect_close
+ accept
+
+ rxreq
+ txresp -hdr "Connection: close" -bodylen 5
+ expect_close
+} -start
+
+varnish v1 -vcl+backend {
+ sub vcl_backend_response {
+ if(bereq.retries == 0) {
+ return(retry);
+ }
+ }
+} -start
+
+client c1 {
+ txreq -url "/"
+ rxresp
+ expect resp.status == 200
+ expect resp.bodylen == 5
+} -run
More information about the varnish-commit
mailing list