Commit feac3715 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Don't do automatic backend retry if we have received anything from the

backend at all.  The retry is only (pseudo-)valid when we have not received
anything at all, indicating that the backend closed before it got our request.

Also don't retry if we sent the request body (not part of test-case).

Fixes #1156
parent ffa30f04
......@@ -480,6 +480,8 @@ FetchHdr(struct req *req, int need_host_hdr, int sendbody)
/* Deal with any message-body the request might have */
i = FetchReqBody(req, sendbody);
if (sendbody && req->reqbodydone)
retry = -1;
if (WRW_FlushRelease(wrk) || i > 0) {
VSLb(req->vsl, SLT_FetchError,
"backend write error: %d (%s)",
......@@ -520,6 +522,7 @@ FetchHdr(struct req *req, int need_host_hdr, int sendbody)
return (retry);
}
if (first) {
retry = -1;
first = 0;
VTCP_set_read_timeout(vc->fd,
vc->between_bytes_timeout);
......
varnishtest "Don't retry if backend ever sent anything"
server s1 {
rxreq
expect req.url == /1
txresp -bodylen 1
rxreq
expect req.url == /2
close
accept
rxreq
expect req.url == /2
txresp -bodylen 2
rxreq
expect req.url == /3
send "200 "
delay .1
close
accept
rxreq
expect req.url == /4
txresp -bodylen 4
} -start
varnish v1 -vcl+backend {} -start
client c1 {
txreq -url /1
rxresp
expect resp.status == 200
expect resp.bodylen == 1
# This one should get retried
txreq -url /2
rxresp
expect resp.status == 200
expect resp.bodylen == 2
# This one should not get retried
txreq -url /3
rxresp
expect resp.status == 503
} -run
client c1 {
txreq -url /4
rxresp
expect resp.status == 200
expect resp.bodylen == 4
} -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment