[6.0] 584a1c98f vbe: Check failures to send the request earlier
Reza Naghibi
reza at naghibi.com
Tue Apr 20 18:35:06 UTC 2021
commit 584a1c98f290448fc981bc389994d9f20f8a4fb3
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Wed Mar 24 17:50:23 2021 +0100
vbe: Check failures to send the request earlier
There's no point waiting for the backend to complain if we weren't able
to properly send the backend request.
Fixes #3556
Conflicts:
bin/varnishd/cache/cache_backend.c
diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index b5217bd4f..99e7358e5 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -282,7 +282,7 @@ vbe_dir_gethdrs(const struct director *d, struct worker *wrk,
i = V1F_SendReq(wrk, bo, &bo->acct.bereq_hdrbytes,
&bo->acct.bereq_bodybytes, 0, abuf, pbuf);
- if (PFD_State(pfd) != PFD_STATE_USED) {
+ if (i == 0 && PFD_State(pfd) != PFD_STATE_USED) {
if (VTP_Wait(wrk, pfd, VTIM_real() +
bo->htc->first_byte_timeout) != 0) {
bo->htc->doclose = SC_RX_TIMEOUT;
diff --git a/bin/varnishtest/tests/r03556.vtc b/bin/varnishtest/tests/r03556.vtc
new file mode 100644
index 000000000..d40afa47f
--- /dev/null
+++ b/bin/varnishtest/tests/r03556.vtc
@@ -0,0 +1,34 @@
+varnishtest "#3556"
+
+server s1 {
+ rxreq
+ txresp
+
+ non_fatal
+ rxreq
+} -start
+
+varnish v1 -cliok "param.set first_byte_timeout 10"
+varnish v1 -vcl+backend {} -start
+
+client c1 {
+ txreq
+ rxresp
+} -run
+
+logexpect l2 -v v1 -q "ReqMethod eq POST" {
+ expect * * End
+} -start
+
+client c2 {
+ txreq -req POST \
+ -hdr "Content-Length: 10" \
+ -hdr "Content-Type: text/plain"
+ send incompl
+} -run
+
+logexpect l2 -wait
+
+shell -expect POST {
+ exec varnishncsa -d -n ${v1_name} -q 'Timestamp:Process[2] < 10.0'
+}
More information about the varnish-commit
mailing list