]> err.no Git - varnish/commitdiff
Spell "content-length" correctly.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 20 Jun 2008 15:49:10 +0000 (15:49 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 20 Jun 2008 15:49:10 +0000 (15:49 +0000)
Add regresion test for ticket 102

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2749 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishtest/tests/a00006.vtc
varnish-cache/bin/varnishtest/tests/a00007.vtc
varnish-cache/bin/varnishtest/tests/r00102.vtc [new file with mode: 0644]
varnish-cache/bin/varnishtest/vtc_http.c

index 3cb1671d08b039654e735a23fd38304a3fa74194..fb0966e5e040d2c41975875ef7fcd0855989c59c 100644 (file)
@@ -8,7 +8,7 @@ server s1 -listen :9080 {
        expect req.proto == HTTP/1.0
        expect req.url == "/foo"
        txresp -proto HTTP/1.2 -status 201 -msg Foo \
-               -hdr "Length: 10" \
+               -hdr "Content-Length: 10" \
                -body "987654321\n"
 }
 
@@ -16,7 +16,7 @@ server s1 -start
 
 client c1 -connect localhost:9080 {
        txreq -req PUT -proto HTTP/1.0 -url /foo \
-               -hdr "Length: 10" \
+               -hdr "Content-Length: 10" \
                -body "123456789\n"
        rxresp
        expect resp.proto == HTTP/1.2
index 34afcb73461263c6236ffa9423ba78a14d888942..f8f82c0b36f7f2acf23db0d62d678d62f3c0678f 100644 (file)
@@ -5,18 +5,20 @@ test "TCP reuse"
 server s1 -listen :9080 {
        rxreq
        expect req.url == "/1"
-       txresp -hdr "Length: 10" -body "123456789\n"
+       txresp -hdr "Content-Length: 10" -body "123456789\n"
        rxreq
        expect req.url == "/2"
-       txresp -hdr "Length: 10" -body "987654321\n"
+       txresp -hdr "Content-Length: 10" -body "987654321\n"
 }
 
 server s1 -start 
 
 client c1 -connect localhost:9080 {
-       txreq -url "/1" -req "POST" -hdr "Length: 10" -body "abcdefghi\n"
+       txreq -url "/1" -req "POST" \
+           -hdr "Content-Length: 10" -body "abcdefghi\n"
        rxresp
-       txreq -url "/2" -req "POST" -hdr "Length: 10" -body "ihgfedcba\n"
+       txreq -url "/2" -req "POST" \
+           -hdr "Content-Length: 10" -body "ihgfedcba\n"
        rxresp
 }
 
diff --git a/varnish-cache/bin/varnishtest/tests/r00102.vtc b/varnish-cache/bin/varnishtest/tests/r00102.vtc
new file mode 100644 (file)
index 0000000..4a3c0f3
--- /dev/null
@@ -0,0 +1,38 @@
+# $Id$
+
+test "Test VCL regsub()"
+
+server s1 {
+       rxreq 
+       txresp \
+               -hdr "Connection: close" \
+               -body "012345\n"
+}
+
+varnish v1 -vcl+backend { 
+       sub vcl_recv {
+               if (req.request == "POST") {
+                       set req.request = "GET";
+               }
+       }
+} -start 
+
+server s1 -start 
+
+client c1 {
+       txreq -req POST -url "/" \
+               -hdr "Content-Length: 10" \
+               -body "123456789\n"
+       rxresp
+       expect resp.status == 200
+       expect resp.http.X-Varnish == "1001"
+
+       txreq -req POST -url "/" \
+               -hdr "Content-Length: 10" \
+               -body "123456789\n"
+       rxresp
+       expect resp.status == 200
+       expect resp.http.X-Varnish == "1002 1001"
+}
+
+client c1 -run
index e7f8163e42a912fed7c4de9393e4903dde2890e1..6232753807ad742708d700a89700215d7e3a9dae 100644 (file)
@@ -240,7 +240,7 @@ http_swallow_body(struct http *hp, char **hh)
        int l, i;
        
 
-       p = http_find_header(hh, "length");
+       p = http_find_header(hh, "content-length");
        if (p == NULL)
                return;
        l = strtoul(p, NULL, 0);