[master] ba46e71df vtc: Exercise test using strings from three different objects
Nils Goroll
nils.goroll at uplex.de
Sun Feb 9 14:14:06 UTC 2025
commit ba46e71df529f8419a7b0c60a3ee4f4686674b61
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Sun Feb 9 13:59:27 2025 +0100
vtc: Exercise test using strings from three different objects
diff --git a/bin/varnishtest/tests/b00092.vtc b/bin/varnishtest/tests/b00092.vtc
new file mode 100644
index 000000000..878c68dd6
--- /dev/null
+++ b/bin/varnishtest/tests/b00092.vtc
@@ -0,0 +1,48 @@
+varnishtest "Use multiple objects for a single request"
+
+server s0 {
+ rxreq
+ txresp -hdr "method: O1_METHOD"
+ rxreq
+ txresp -hdr "url: /o2_url"
+ rxreq
+ txresp -hdr "val: 3"
+} -start
+
+
+# we use req.method and url because they could simply keep a reference to
+# the object rather than copying, while, to copy headers, we currently always
+# copy anyway to (re)generate the header name (we could avoid that by special
+# casing copies from workspaces and objects)
+
+varnish v1 -vcl+backend {
+ import debug;
+
+ sub vcl_recv {
+ return (pass);
+ }
+ sub vcl_deliver {
+ if (req.restarts == 0) {
+ set req.method = resp.http.method;
+ debug.log_strands("resp.http.method", resp.http.method);
+ } else if (req.restarts == 1) {
+ set req.url = resp.http.url;
+ debug.log_strands("resp.http.url", resp.http.url);
+ } else {
+ set resp.http.method = req.method;
+ set resp.http.url = req.url;
+ debug.log_strands("req.method", req.method);
+ debug.log_strands("req.url", req.url);
+ return (deliver);
+ }
+ return (restart);
+ }
+} -start
+
+client c1 {
+ txreq
+ rxresp
+ expect resp.http.method == O1_METHOD
+ expect resp.http.url == /o2_url
+ expect resp.http.val == 3
+} -run
More information about the varnish-commit
mailing list