[master] 660fedef8 v1p: No timeout when timeout_pipe is zero

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed Jan 31 16:37:05 UTC 2024


commit 660fedef850c8f2ff7d372ef8c037412092c57c3
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Fri Jan 19 16:27:58 2024 +0100

    v1p: No timeout when timeout_pipe is zero

diff --git a/bin/varnishd/http1/cache_http1_pipe.c b/bin/varnishd/http1/cache_http1_pipe.c
index d273ae4f4..0c4a69a03 100644
--- a/bin/varnishd/http1/cache_http1_pipe.c
+++ b/bin/varnishd/http1/cache_http1_pipe.c
@@ -117,6 +117,7 @@ void
 V1P_Process(const struct req *req, int fd, struct v1p_acct *v1a)
 {
 	struct pollfd fds[2];
+	vtim_dur tmo;
 	int i, j;
 
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
@@ -142,8 +143,10 @@ V1P_Process(const struct req *req, int fd, struct v1p_acct *v1a)
 	while (fds[0].fd > -1 || fds[1].fd > -1) {
 		fds[0].revents = 0;
 		fds[1].revents = 0;
-		i = poll(fds, 2,
-		    (int)(cache_param->pipe_timeout * 1e3));
+		tmo = cache_param->pipe_timeout;
+		if (tmo == 0.)
+			tmo = -1.;
+		i = poll(fds, 2, (int)(tmo * 1e3));
 		if (i < 1)
 			break;
 		if (fds[0].revents &&
diff --git a/bin/varnishtest/tests/s00013.vtc b/bin/varnishtest/tests/s00013.vtc
new file mode 100644
index 000000000..ac7168bb1
--- /dev/null
+++ b/bin/varnishtest/tests/s00013.vtc
@@ -0,0 +1,22 @@
+varnishtest "pipe timeouts"
+
+server s1 {
+	rxreq
+	txresp -hdr "transfer-encoding: chunked"
+	delay 1.1
+} -start
+
+varnish v1 -cliok "param.set pipe_timeout 0s"
+varnish v1 -vcl+backend "" -start
+
+logexpect l1 -v v1 -q "Timestamp:PipeSess[2] > 1.0" {
+	expect 1001 * ReqMethod PIPE
+} -start
+
+client c1 {
+	non_fatal
+	txreq -method PIPE
+	rxresp
+} -run
+
+logexpect l1 -wait


More information about the varnish-commit mailing list