[master] 17dcc37 Add test for the empty and non-existing varied-upon header resulting in individual cache objects

Nils Goroll nils.goroll at uplex.de
Tue Jan 6 19:56:26 CET 2015


commit 17dcc37859f9dfcbb9a4641f503fe6ffac856668
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue Jan 6 19:52:54 2015 +0100

    Add test for the empty and non-existing varied-upon header resulting in individual cache objects
    
    Outcome of a discussion of the suggestion to treat empty headers like
    non-existing for Vary processing:
    
    https://www.varnish-cache.org/lists/pipermail/varnish-dev/2015-January/008131.html

diff --git a/bin/varnishtest/tests/c00004.vtc b/bin/varnishtest/tests/c00004.vtc
index 56af641..c4d7ad5 100644
--- a/bin/varnishtest/tests/c00004.vtc
+++ b/bin/varnishtest/tests/c00004.vtc
@@ -4,14 +4,22 @@ server s1 {
 	rxreq
 	expect req.http.foobar == "1"
 	txresp -hdr "Vary: Foobar" -hdr "Snafu: 1" -body "1111\n"
+
 	rxreq
 	expect req.http.foobar == "2"
 	txresp -hdr "Vary: Foobar" -hdr "Snafu: 2" -body "2222\n"
+
 	rxreq
 	expect req.http.foobar == "3"
 	txresp -hdr "Vary: Foobar" -hdr "Snafu: 3" -body "3333\n"
+
 	rxreq
+	expect req.http.foobar == <undef>
 	txresp -hdr "Vary: Foobar" -hdr "Snafu: 4" -body "4444\n"
+
+	rxreq
+	expect req.http.foobar == ""
+	txresp -hdr "Vary: Foobar" -hdr "Snafu: 5" -body "5555\n"
 } -start
 
 varnish v1 -vcl+backend {} -start
@@ -47,4 +55,17 @@ client c1 {
 	expect resp.http.X-Varnish == "1009 1002"
 	expect resp.http.snafu == "1"
 
+	txreq -hdr "Foobar:  1 "
+	rxresp
+	expect resp.status == 200
+	expect resp.http.X-Varnish == "1010 1002"
+	expect resp.http.snafu == "1"
+
+	# empty header != no header
+	txreq -hdr "Foobar:  "
+	rxresp
+	expect resp.status == 200
+	expect resp.http.X-Varnish == "1011"
+	expect resp.http.snafu == "5"
+
 } -run



More information about the varnish-commit mailing list