forked from varnishcache/varnish-cache
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
respect
send_timeout
for "dripping" http1 writes
Previously, we only checked `v1l->deadline` (which gets initialized from the `send_timeout` session attribute or parameter) only for short writes, so for successful "dripping" http1 writes (streaming from a backend busy object with small chunks), we did not respect the timeout. This patch restructures `V1L_Flush()` to always check the deadline before a write by turning a `while() { ... }` into a `do { ... } while` with the same continuation criteria: `while (i != v1l->liov)` is turned into `if (i == v1l->liov) break;` and `while (i > 0 || errno == EWOULDBLOCK)` is kept to retry short writes. This also reduces the `writev()` call sites to one. Fixes varnishcache#3189
- Loading branch information
Showing
3 changed files
with
43 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
varnishtest "h1 send_timeout and streaming of dripping chunks" | ||
|
||
server s1 { | ||
rxreq | ||
txresp -nolen -hdr "Transfer-Encoding: chunked" | ||
chunkedlen 1 | ||
delay 1 | ||
non_fatal | ||
chunkedlen 1 | ||
delay 1 | ||
chunkedlen 0 | ||
} -start | ||
|
||
varnish v1 \ | ||
-arg "-p idle_send_timeout=.1" \ | ||
-arg "-p send_timeout=1" \ | ||
-vcl+backend { } -start | ||
|
||
client c1 { | ||
txreq | ||
rxresphdrs | ||
rxchunk | ||
expect_close | ||
} -run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters