From: phk Date: Fri, 20 Jun 2008 15:49:10 +0000 (+0000) Subject: Spell "content-length" correctly. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97b10f5acf830ebf0830b5ba90789ecb3be78254;p=varnish Spell "content-length" correctly. Add regresion test for ticket 102 git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2749 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishtest/tests/a00006.vtc b/varnish-cache/bin/varnishtest/tests/a00006.vtc index 3cb1671d..fb0966e5 100644 --- a/varnish-cache/bin/varnishtest/tests/a00006.vtc +++ b/varnish-cache/bin/varnishtest/tests/a00006.vtc @@ -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 diff --git a/varnish-cache/bin/varnishtest/tests/a00007.vtc b/varnish-cache/bin/varnishtest/tests/a00007.vtc index 34afcb73..f8f82c0b 100644 --- a/varnish-cache/bin/varnishtest/tests/a00007.vtc +++ b/varnish-cache/bin/varnishtest/tests/a00007.vtc @@ -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 index 00000000..4a3c0f36 --- /dev/null +++ b/varnish-cache/bin/varnishtest/tests/r00102.vtc @@ -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 diff --git a/varnish-cache/bin/varnishtest/vtc_http.c b/varnish-cache/bin/varnishtest/vtc_http.c index e7f8163e..62327538 100644 --- a/varnish-cache/bin/varnishtest/vtc_http.c +++ b/varnish-cache/bin/varnishtest/vtc_http.c @@ -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);