[master] 76bc57e3d vmod_std: test negative number in string argument to std.duration()
Nils Goroll
nils.goroll at uplex.de
Mon Dec 22 18:31:05 UTC 2025
commit 76bc57e3d5b3b54878e263833856f11bcad193ed
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Mon Dec 22 19:29:57 2025 +0100
vmod_std: test negative number in string argument to std.duration()
diff --git a/vmod/tests/std_b00002.vtc b/vmod/tests/std_b00002.vtc
index de5f7c4d7..e19ca6bef 100644
--- a/vmod/tests/std_b00002.vtc
+++ b/vmod/tests/std_b00002.vtc
@@ -20,6 +20,9 @@ varnish v1 -vcl+backend {
} else if (req.http.duration-nf) {
set resp.http.duration =
std.duration(req.http.duration) + 1000000s;
+ } else if (req.http.duration-lit) {
+ set resp.http.duration =
+ std.duration(req.http.duration-lit, 0.42s);
} else {
set resp.http.duration =
std.duration(req.http.duration, 1s) + 1000000s;
@@ -133,6 +136,10 @@ client c1 {
expect resp.http.duration == 1036000.000
expect resp.http.bytes == 131941395845
+ txreq -hdr "duration-lit: -12.345s"
+ rxresp
+ expect resp.http.duration == -12.345
+
txreq -hdr "d-real: -100"
rxresp
expect resp.http.duration == 999900.000
More information about the varnish-commit
mailing list