[master] e36573e25 Add a test-case for hash_data() in vcl_recv{}

Poul-Henning Kamp phk at FreeBSD.org
Fri Feb 12 10:33:06 UTC 2021


commit e36573e255af2aa1ed40fb367fcb5257ef7e0288
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Feb 12 08:19:31 2021 +0000

    Add a test-case for hash_data() in vcl_recv{}

diff --git a/bin/varnishtest/tests/b00076.vtc b/bin/varnishtest/tests/b00076.vtc
new file mode 100644
index 000000000..971c7774e
--- /dev/null
+++ b/bin/varnishtest/tests/b00076.vtc
@@ -0,0 +1,31 @@
+varnishtest "hash_data() in vcl_recv{}"
+
+server s1 {
+	rxreq
+	txresp -hdr "Same: One"
+} -start
+
+varnish v1 -vcl+backend {
+    sub vcl_recv {
+	if (req.url == "/2") {
+		hash_data(req.http.foo);
+	}
+    }
+    sub vcl_hash {
+	hash_data(req.url);
+	return (lookup);
+    }
+} -start
+
+varnish v1 -cliok "param.set vsl_mask +Hash"
+
+client c1 {
+	txreq -url /1
+	rxresp
+	expect resp.status == 200
+	expect resp.http.same == One
+	txreq -url /2 -hdr "foo: /1"
+	rxresp
+	expect resp.status == 200
+	expect resp.http.same == One
+} -run


More information about the varnish-commit mailing list