[master] 757e71956 vrt_var: Return VRT_DECIMAL_MAX for "never" timeouts

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Tue Mar 5 08:53:09 UTC 2024


commit 757e7195664149abcc034b109c28023cc95ba879
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Feb 29 12:32:12 2024 +0100

    vrt_var: Return VRT_DECIMAL_MAX for "never" timeouts

diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index be84f1c0c..a7e018713 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -45,6 +45,8 @@
 
 #include "vrt_obj.h"
 
+#define VRT_TMO(tmo) (isinf(tmo) ? VRT_DECIMAL_MAX : tmo)
+
 static char vrt_hostname[255] = "";
 
 /*--------------------------------------------------------------------
@@ -403,7 +405,7 @@ VRT_r_bereq_##which(VRT_CTX)					\
 								\
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);			\
 	CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);		\
-	return (BUSYOBJ_TMO(ctx->bo, prefix, which));		\
+	return (VRT_TMO(BUSYOBJ_TMO(ctx->bo, prefix, which)));	\
 }								\
 								\
 VCL_VOID							\
@@ -1144,7 +1146,7 @@ VRT_r_sess_##x(VRT_CTX)					\
 {							\
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);		\
 	CHECK_OBJ_NOTNULL(ctx->sp, SESS_MAGIC);		\
-	return (SESS_TMO(ctx->sp, x));			\
+	return (VRT_TMO(SESS_TMO(ctx->sp, x)));		\
 }							\
 							\
 VCL_VOID						\
diff --git a/bin/varnishtest/tests/v00071.vtc b/bin/varnishtest/tests/v00071.vtc
new file mode 100644
index 000000000..ef073e877
--- /dev/null
+++ b/bin/varnishtest/tests/v00071.vtc
@@ -0,0 +1,19 @@
+varnishtest "Disabled timeout in VCL"
+
+varnish v1 -cliok "param.set idle_send_timeout never"
+
+varnish v1 -vcl {
+	backend be none;
+	sub vcl_recv {
+		return (synth(200));
+	}
+	sub vcl_synth {
+		set resp.http.idle_send_timeout = sess.idle_send_timeout;
+	}
+} -start
+
+client c1 {
+	txreq
+	rxresp
+	expect resp.http.idle_send_timeout == 999999999999.999
+} -run


More information about the varnish-commit mailing list