[4.0] d850882 Add tests for outgoing Connection: close handling

Poul-Henning Kamp phk at FreeBSD.org
Tue Apr 1 15:09:53 CEST 2014


commit d850882688678e514bc01766390b1f93731057ba
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Mar 24 10:22:54 2014 +0000

    Add tests for outgoing Connection: close handling

diff --git a/bin/varnishtest/tests/c00064.vtc b/bin/varnishtest/tests/c00064.vtc
new file mode 100644
index 0000000..4791597
--- /dev/null
+++ b/bin/varnishtest/tests/c00064.vtc
@@ -0,0 +1,35 @@
+varnishtest "Connection: close in vcl_synth{}"
+
+server s1 {
+	rxreq
+	txresp -status 400
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_miss {
+		if (req.url == "/333") {
+			return (synth(333, "FOO"));
+		} else {
+			return (synth(334, "BAR"));
+		}
+	}
+
+	sub vcl_synth {
+		if (resp.status == 333) {
+			set resp.http.connection = "close";
+		}
+	}
+} -start
+
+client c1 {
+	txreq -url /334
+	rxresp
+	expect resp.status == 334
+	txreq -url /334
+	rxresp
+	expect resp.status == 334
+	txreq -url /333
+	rxresp
+	expect resp.status == 333
+	expect_close
+} -run
diff --git a/bin/varnishtest/tests/c00065.vtc b/bin/varnishtest/tests/c00065.vtc
new file mode 100644
index 0000000..aed48cd
--- /dev/null
+++ b/bin/varnishtest/tests/c00065.vtc
@@ -0,0 +1,24 @@
+varnishtest "Connection: close in vcl_deliver{}"
+
+server s1 {
+	rxreq
+	txresp
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_deliver {
+		set resp.http.Connection  = "close";
+	}
+} -start
+
+client c1 {
+	txreq
+	rxresp
+	expect_close
+} -run
+
+client c1 {
+	txreq
+	rxresp
+	expect_close
+} -run



More information about the varnish-commit mailing list