Mailing List Archive

[master] b8efd99ab Ensure we don't recycle a closed backend connection
commit b8efd99aba079fe9bc92ec7f70a839527fff321a
Author: Dag Haavi Finstad <daghf@varnish-software.com>
Date: Wed Apr 1 15:52:31 2020 +0200

Ensure we don't recycle a closed backend connection

Fixes: #3266

diff --git a/bin/varnishd/http1/cache_http1_vfp.c b/bin/varnishd/http1/cache_http1_vfp.c
index 7e4782a15..5e3b5cfa0 100644
--- a/bin/varnishd/http1/cache_http1_vfp.c
+++ b/bin/varnishd/http1/cache_http1_vfp.c
@@ -81,6 +81,9 @@ v1f_read(const struct vfp_ctx *vc, struct http_conn *htc, void *d, ssize_t len)
"%s", vstrerror(errno));
return (i);
}
+ if (i == 0)
+ htc->doclose = SC_RESP_CLOSE;
+
}
return (i + l);
}
diff --git a/bin/varnishtest/tests/r03266.vtc b/bin/varnishtest/tests/r03266.vtc
new file mode 100644
index 000000000..1c4718192
--- /dev/null
+++ b/bin/varnishtest/tests/r03266.vtc
@@ -0,0 +1,19 @@
+varnishtest "Don't recycle a closed backend connection"
+
+# broken origin: sends eof-encoded HTTP/1.1 response
+server s1 {
+ rxreq
+ send "HTTP/1.1 200 OK\r\n\r\n"
+ send "foobar"
+} -start
+
+varnish v1 -vcl+backend {} -start
+
+client c1 {
+ txreq
+ rxresp
+} -run
+
+varnish v1 -expect fetch_failed == 0
+varnish v1 -expect fetch_eof == 1
+varnish v1 -expect backend_recycle == 0
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit