r5476 - in trunk/varnish-cache/bin: varnishd varnishtest varnishtest/tests

martin at varnish-cache.org martin at varnish-cache.org
Wed Oct 27 14:30:21 CEST 2010


Author: martin
Date: 2010-10-27 14:30:21 +0200 (Wed, 27 Oct 2010)
New Revision: 5476

Modified:
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
   trunk/varnish-cache/bin/varnishtest/tests/b00007.vtc
   trunk/varnish-cache/bin/varnishtest/tests/r00387.vtc
   trunk/varnish-cache/bin/varnishtest/vtc_http.c
Log:
Read expected final CRLF after chunked encoding data from backend.
Make "chunkedlen" test server command output final CRLF after chunked data.
Update a couple of test cases to output the final CRLF.

Fixes: #780



Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2010-10-27 11:54:02 UTC (rev 5475)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2010-10-27 12:30:21 UTC (rev 5476)
@@ -207,6 +207,15 @@
 		q = bp = buf + v;
 	}
 
+	/* Expect a CRLF to trail the chunks */
+	i = HTC_Read(htc, buf, 1);
+	if (i == 1 && buf[0] == '\r')
+		i = HTC_Read(htc, buf, 1);
+	if (i != 1 || buf[0] != '\n') {
+		WSP(sp, SLT_FetchError, "chunked missing trailing crlf");
+		return (1);	/* Accept fetch, but do not reuse connection */
+	}
+
 	if (st != NULL && st->len == 0) {
 		VTAILQ_REMOVE(&sp->obj->store, st, list);
 		STV_free(st);

Modified: trunk/varnish-cache/bin/varnishtest/tests/b00007.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/b00007.vtc	2010-10-27 11:54:02 UTC (rev 5475)
+++ trunk/varnish-cache/bin/varnishtest/tests/b00007.vtc	2010-10-27 12:30:21 UTC (rev 5476)
@@ -10,6 +10,7 @@
 	send "\r\n"
 	send "00000004\r\n1234\r\n"
 	send "00000000\r\n"
+	send "\r\n"
 
 	rxreq 
 	expect req.url == "/foo"

Modified: trunk/varnish-cache/bin/varnishtest/tests/r00387.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/r00387.vtc	2010-10-27 11:54:02 UTC (rev 5475)
+++ trunk/varnish-cache/bin/varnishtest/tests/r00387.vtc	2010-10-27 12:30:21 UTC (rev 5476)
@@ -10,6 +10,7 @@
 	send "004\r\n1234\r\n"
 	send "000000000000000000001\r\n@\r\n"
 	send "00000000\r\n"
+	send "\r\n"
 } -start
 
 varnish v1 -vcl+backend {} -start

Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_http.c	2010-10-27 11:54:02 UTC (rev 5475)
+++ trunk/varnish-cache/bin/varnishtest/vtc_http.c	2010-10-27 12:30:21 UTC (rev 5476)
@@ -778,7 +778,7 @@
 		vsb_printf(hp->vsb, "%x%s", v, nl);
 		vsb_printf(hp->vsb, "%*.*s%s", v, v, buf, nl);
 	}
-	vsb_printf(hp->vsb, "%x%s", 0, nl);
+	vsb_printf(hp->vsb, "%x%s%s", 0, nl, nl);
 	http_write(hp, 4, "chunked");
 }
 




More information about the varnish-commit mailing list