r2749 - in trunk/varnish-cache/bin/varnishtest: . tests

phk at projects.linpro.no phk at projects.linpro.no
Fri Jun 20 17:49:11 CEST 2008


Author: phk
Date: 2008-06-20 17:49:10 +0200 (Fri, 20 Jun 2008)
New Revision: 2749

Added:
   trunk/varnish-cache/bin/varnishtest/tests/r00102.vtc
Modified:
   trunk/varnish-cache/bin/varnishtest/tests/a00006.vtc
   trunk/varnish-cache/bin/varnishtest/tests/a00007.vtc
   trunk/varnish-cache/bin/varnishtest/vtc_http.c
Log:
Spell "content-length" correctly.

Add regresion test for ticket 102



Modified: trunk/varnish-cache/bin/varnishtest/tests/a00006.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/a00006.vtc	2008-06-20 15:34:14 UTC (rev 2748)
+++ trunk/varnish-cache/bin/varnishtest/tests/a00006.vtc	2008-06-20 15:49:10 UTC (rev 2749)
@@ -8,7 +8,7 @@
 	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 @@
 
 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

Modified: trunk/varnish-cache/bin/varnishtest/tests/a00007.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/a00007.vtc	2008-06-20 15:34:14 UTC (rev 2748)
+++ trunk/varnish-cache/bin/varnishtest/tests/a00007.vtc	2008-06-20 15:49:10 UTC (rev 2749)
@@ -5,18 +5,20 @@
 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
 }
 

Added: trunk/varnish-cache/bin/varnishtest/tests/r00102.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/r00102.vtc	                        (rev 0)
+++ trunk/varnish-cache/bin/varnishtest/tests/r00102.vtc	2008-06-20 15:49:10 UTC (rev 2749)
@@ -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

Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_http.c	2008-06-20 15:34:14 UTC (rev 2748)
+++ trunk/varnish-cache/bin/varnishtest/vtc_http.c	2008-06-20 15:49:10 UTC (rev 2749)
@@ -240,7 +240,7 @@
 	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);




More information about the varnish-commit mailing list