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

phk at varnish-cache.org phk at varnish-cache.org
Mon May 31 10:00:23 CEST 2010


Author: phk
Date: 2010-05-31 10:00:23 +0200 (Mon, 31 May 2010)
New Revision: 4865

Added:
   trunk/varnish-cache/bin/varnishtest/tests/r00702.vtc
Modified:
   trunk/varnish-cache/bin/varnishd/cache_response.c
Log:
Fix an off-by-one bug, when requested range exceeds available data.

Submitted by: 	Luc Saillard


Modified: trunk/varnish-cache/bin/varnishd/cache_response.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_response.c	2010-05-31 07:51:43 UTC (rev 4864)
+++ trunk/varnish-cache/bin/varnishd/cache_response.c	2010-05-31 08:00:23 UTC (rev 4865)
@@ -169,7 +169,7 @@
 		return;
 
 	if (high >= sp->obj->len)
-		high = sp->obj->len;
+		high = sp->obj->len - 1;
 
 	if (low > high)
 		return;

Added: trunk/varnish-cache/bin/varnishtest/tests/r00702.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/r00702.vtc	                        (rev 0)
+++ trunk/varnish-cache/bin/varnishtest/tests/r00702.vtc	2010-05-31 08:00:23 UTC (rev 4865)
@@ -0,0 +1,22 @@
+# $Id$
+
+test "Range bug"
+
+server s1 {
+	rxreq
+	txresp -bodylen 100
+} -start
+
+varnish v1 -vcl+backend {
+} -start
+
+varnish v1 -cliok "param.set http_range_support on"
+
+
+client c1 {
+	txreq -hdr "Range: bytes=50-200"
+	rxresp
+	expect resp.status == 206
+	expect resp.bodylen == 50
+} -run
+




More information about the varnish-commit mailing list