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"
}
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
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
}
--- /dev/null
+# $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
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);