[6.0] 70878b172 Add an out-of-workspace test for VMOD blob's sub() function.

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Aug 16 08:53:20 UTC 2018


commit 70878b1722981dcb96ad8732a2277d1f48f566df
Author: Geoff Simmons <geoff at uplex.de>
Date:   Wed Jul 18 14:45:50 2018 +0200

    Add an out-of-workspace test for VMOD blob's sub() function.

diff --git a/bin/varnishtest/tests/m00049.vtc b/bin/varnishtest/tests/m00049.vtc
index 6850ffc26..17ea49e84 100644
--- a/bin/varnishtest/tests/m00049.vtc
+++ b/bin/varnishtest/tests/m00049.vtc
@@ -161,3 +161,26 @@ varnish v1 -vcl {
 client c1 -run
 client c2 -run
 client c3 -run
+
+# sub() function
+varnish v1 -vcl {
+	import blob;
+	import vtc;
+	backend b { .host = "${bad_ip}"; }
+
+	sub vcl_miss {
+		if (req.url == "/1") {
+			# Not enough for req.hash + vmod_priv
+			vtc.workspace_alloc(client, -65);
+		}
+		elsif (req.url == "/2") {
+			# Not enough for req.hash + vmod_priv + 30 bytes
+			vtc.workspace_alloc(client, -90);
+		}
+		set req.http.Encode = blob.encode(blob=blob.sub(req.hash, 30B));
+		return( synth(200) );
+	}
+}
+
+client c1 -run
+client c2 -run


More information about the varnish-commit mailing list