Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Varnish: Commits
[3.0] 33d0e41 Make it possible to test for the non-definition of a http header.
 

Index | Next | Previous | View Flat


tfheen at varnish-cache

Apr 16, 2012, 1:20 AM


Views: 67
Permalink
[3.0] 33d0e41 Make it possible to test for the non-definition of a http header.

commit 33d0e410f4391de29ed08904485cd114164a37cd
Author: Poul-Henning Kamp <phk [at] FreeBSD>
Date: Mon Nov 28 09:11:28 2011 +0000

Make it possible to test for the non-definition of a http header.

Fixes #1062

diff --git a/bin/varnishtest/tests/a00012.vtc b/bin/varnishtest/tests/a00012.vtc
new file mode 100644
index 0000000..07e51c1
--- /dev/null
+++ b/bin/varnishtest/tests/a00012.vtc
@@ -0,0 +1,13 @@
+varnishtest "Ensure that we can test non-existence of headers (#1062)"
+
+server s1 {
+ rxreq
+ txresp
+} -start
+
+client c1 -connect ${s1_sock} {
+ txreq
+ rxresp
+ expect resp.http.X-Test == <undef>
+} -run
+
diff --git a/bin/varnishtest/tests/c00016.vtc b/bin/varnishtest/tests/c00016.vtc
index d028a64..99e9c53 100644
--- a/bin/varnishtest/tests/c00016.vtc
+++ b/bin/varnishtest/tests/c00016.vtc
@@ -8,7 +8,7 @@ server s1 {

rxreq
expect req.url == "/bar"
- expect req.http.Foo == "req.http.Foo"
+ expect req.http.Foo == <undef>
txresp -hdr "Bar: fnry,glyf, FOO ,brok" -hdr "Connection: bar" -body "foobar"
} -start

@@ -21,5 +21,5 @@ client c1 {

txreq -url "/bar" -hdr "Foo: bar2" -hdr "Connection: foo, close"
rxresp
- expect req.http.Bar == "req.http.Bar"
+ expect req.http.Bar == <undef>
} -run
diff --git a/bin/varnishtest/tests/e00024.vtc b/bin/varnishtest/tests/e00024.vtc
index 2aa8e3a..f728b3c 100644
--- a/bin/varnishtest/tests/e00024.vtc
+++ b/bin/varnishtest/tests/e00024.vtc
@@ -81,7 +81,7 @@ client c1 {

txreq
rxresp
- expect resp.http.content-encoding == resp.http.content-encoding
+ expect resp.http.content-encoding == <undef>
expect resp.status == 200
expect resp.bodylen == 252
} -run
diff --git a/bin/varnishtest/tests/e00025.vtc b/bin/varnishtest/tests/e00025.vtc
index 5549f5c..5e8a12b 100644
--- a/bin/varnishtest/tests/e00025.vtc
+++ b/bin/varnishtest/tests/e00025.vtc
@@ -18,7 +18,7 @@ client c1 {

txreq
rxresp
- expect resp.http.content-encoding == resp.http.content-encoding
+ expect resp.http.content-encoding == <undef>
expect resp.status == 200
expect resp.bodylen == 3
} -run
diff --git a/bin/varnishtest/tests/g00001.vtc b/bin/varnishtest/tests/g00001.vtc
index 34ad00f..e10b743 100644
--- a/bin/varnishtest/tests/g00001.vtc
+++ b/bin/varnishtest/tests/g00001.vtc
@@ -13,7 +13,7 @@ client c1 {
txreq
rxresp
expect resp.bodylen == "3"
- expect resp.http.content-encoding == "resp.http.content-encoding"
+ expect resp.http.content-encoding == <undef>

txreq -hdr "Accept-encoding: gzip;q=0.1"
rxresp
@@ -26,13 +26,13 @@ client c1 {
txreq -proto HTTP/1.0
rxresp
expect resp.bodylen == "3"
- expect resp.http.content-encoding == "resp.http.content-encoding"
+ expect resp.http.content-encoding == <undef>
} -run

client c1 {
txreq -req HEAD
rxresp -no_obj
- expect resp.http.content-encoding == "resp.http.content-encoding"
+ expect resp.http.content-encoding == <undef>

txreq -req HEAD -hdr "Accept-encoding: gzip;q=0.1"
rxresp -no_obj
diff --git a/bin/varnishtest/tests/g00002.vtc b/bin/varnishtest/tests/g00002.vtc
index 1a0ab35..dad45bc 100644
--- a/bin/varnishtest/tests/g00002.vtc
+++ b/bin/varnishtest/tests/g00002.vtc
@@ -39,12 +39,12 @@ client c1 {
# See varnish can gunzip it.
txreq -url /foo -hdr "Accept-Encoding: null"
rxresp
- expect resp.http.content-encoding == "resp.http.content-encoding"
+ expect resp.http.content-encoding == <undef>
expect resp.bodylen == 4100

# See varnish can gunzip it, inside ESI
txreq -url /bar -hdr "Accept-Encoding: null"
rxresp
- expect resp.http.content-encoding == "resp.http.content-encoding"
+ expect resp.http.content-encoding == <undef>
expect resp.bodylen == 4109
} -run
diff --git a/bin/varnishtest/tests/g00003.vtc b/bin/varnishtest/tests/g00003.vtc
index dcd8936..05edb5d 100644
--- a/bin/varnishtest/tests/g00003.vtc
+++ b/bin/varnishtest/tests/g00003.vtc
@@ -30,12 +30,12 @@ varnish v1 -cliok "param.set http_gzip_support true" -vcl+backend {
client c1 {
txreq -url /foo -hdr "Accept-Encoding: gzip"
rxresp
- expect resp.http.content-encoding == "resp.http.content-encoding"
+ expect resp.http.content-encoding == <undef>
expect resp.bodylen == 41

txreq -url /bar -hdr "Accept-Encoding: gzip"
rxresp
- expect resp.http.content-encoding == "resp.http.content-encoding"
+ expect resp.http.content-encoding == <undef>
expect resp.bodylen == 42

txreq -url /foobar -hdr "Accept-Encoding: gzip"
@@ -46,6 +46,6 @@ client c1 {

txreq -url /foobar
rxresp
- expect resp.http.content-encoding == "resp.http.content-encoding"
+ expect resp.http.content-encoding == <undef>
expect resp.bodylen == 43
} -run
diff --git a/bin/varnishtest/tests/r00292.vtc b/bin/varnishtest/tests/r00292.vtc
index aaa914c..7739e85 100644
--- a/bin/varnishtest/tests/r00292.vtc
+++ b/bin/varnishtest/tests/r00292.vtc
@@ -6,11 +6,11 @@ varnishtest "Header deletion test"
server s1 {
rxreq
expect req.url == "/foo"
- expect req.http.hdr1 == "req.http.hdr1"
+ expect req.http.hdr1 == <undef>
expect req.http.hdr2 == "2"
- expect req.http.hdr3 == "req.http.hdr3"
+ expect req.http.hdr3 == <undef>
expect req.http.hdr4 == "4"
- expect req.http.hdr5 == "req.http.hdr5"
+ expect req.http.hdr5 == <undef>
expect req.http.hdr6 == "6"
txresp -body "foobar"
} -start
diff --git a/bin/varnishtest/tests/r00466.vtc b/bin/varnishtest/tests/r00466.vtc
index acff68a..8d753ba 100644
--- a/bin/varnishtest/tests/r00466.vtc
+++ b/bin/varnishtest/tests/r00466.vtc
@@ -3,7 +3,7 @@ varnishtest "Check Range forwarding to backend"
server s1 {
rxreq
expect req.url == "/foo"
- expect req.http.range == "req.http.range"
+ expect req.http.range == <undef>
txresp \
-hdr "Foobar: _barf_" \
-body "012345\n"
diff --git a/bin/varnishtest/tests/r00494.vtc b/bin/varnishtest/tests/r00494.vtc
index d1dedd1..1a7fec3 100644
--- a/bin/varnishtest/tests/r00494.vtc
+++ b/bin/varnishtest/tests/r00494.vtc
@@ -19,6 +19,6 @@ client c1 {
txreq
rxresp
expect resp.http.bar == "bar, barf: fail"
- expect resp.http.barf == resp.http.barf
- expect resp.http.foo == resp.http.foo
+ expect resp.http.barf == <undef>
+ expect resp.http.foo == <undef>
} -run
diff --git a/bin/varnishtest/tests/r00693.vtc b/bin/varnishtest/tests/r00693.vtc
index 6cf7b30..37b0a98 100644
--- a/bin/varnishtest/tests/r00693.vtc
+++ b/bin/varnishtest/tests/r00693.vtc
@@ -4,11 +4,11 @@ feature 64bit

server s1 {
rxreq
- expect req.http.baz == "req.http.baz"
+ expect req.http.baz == <undef>
txresp -status 201

rxreq
- expect req.http.baz == "req.http.baz"
+ expect req.http.baz == <undef>
txresp -status 202

rxreq
@@ -52,7 +52,7 @@ varnish v1 -arg "-p sess_workspace=1024" -vcl+backend {
"0123456789abcdef" + "0123456789abcdef" +
"0123456789abcdef" + "0123456789abcdef" +
"0123456789abcdef" +
- "01234567";
+ "0123456";
set req.http.baz = "BAZ";
return (pass);
}
diff --git a/bin/varnishtest/tests/r00861.vtc b/bin/varnishtest/tests/r00861.vtc
index 165795b..8a3e8a0 100644
--- a/bin/varnishtest/tests/r00861.vtc
+++ b/bin/varnishtest/tests/r00861.vtc
@@ -34,12 +34,12 @@ varnish v1 \
client c1 {
txreq -url "/1"
rxresp
- expect resp.http.Content-Encoding == resp.http.Content-Encoding
+ expect resp.http.Content-Encoding == <undef>
expect resp.bodylen == 22

txreq -url "/barf" -hdr "Accept-Encoding: gzip"
rxresp
- expect resp.http.Content-Encoding == resp.http.Content-Encoding
+ expect resp.http.Content-Encoding == <undef>
expect resp.bodylen == 909

txreq -url "/2" -hdr "Accept-Encoding: gzip"
diff --git a/bin/varnishtest/tests/r00980.vtc b/bin/varnishtest/tests/r00980.vtc
index 9591786..b7d307e 100644
--- a/bin/varnishtest/tests/r00980.vtc
+++ b/bin/varnishtest/tests/r00980.vtc
@@ -24,6 +24,6 @@ client c1 {

txreq -url /foobar
rxresp
- expect resp.http.content-encoding == "resp.http.content-encoding"
+ expect resp.http.content-encoding == <undef>
expect resp.bodylen == 43
} -run
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index c71d9d2..66e1d23 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -175,7 +175,7 @@ http_find_header(char * const *hh, const char *hdr)
* Expect
*/

-static char *
+static const char *
cmd_var_resolve(struct http *hp, char *spec)
{
char **hh, *hdr;
@@ -207,16 +207,16 @@ cmd_var_resolve(struct http *hp, char *spec)
hdr = http_find_header(hh, hdr);
if (hdr != NULL)
return (hdr);
- return (spec);
+ return ("<undef>");
}

static void
cmd_http_expect(CMD_ARGS)
{
struct http *hp;
- char *lhs;
+ const char *lhs;
char *cmp;
- char *rhs;
+ const char *rhs;

(void)cmd;
(void)vl;

_______________________________________________
varnish-commit mailing list
varnish-commit [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit

Subject User Time
[3.0] 33d0e41 Make it possible to test for the non-definition of a http header. tfheen at varnish-cache Apr 16, 2012, 1:20 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.