[master] b96d77c89 range: Let 416s pass through

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed Sep 1 17:13:05 UTC 2021


commit b96d77c89cd0983e52e3ddca87b49fb7adc555df
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Wed Sep 1 18:50:37 2021 +0200

    range: Let 416s pass through
    
    Reported by Simon as a followup to #3683.

diff --git a/bin/varnishd/cache/cache_range.c b/bin/varnishd/cache/cache_range.c
index 71793ab4e..402884e5f 100644
--- a/bin/varnishd/cache/cache_range.c
+++ b/bin/varnishd/cache/cache_range.c
@@ -300,6 +300,8 @@ VRG_CheckBo(struct busyobj *bo)
 	if (crlo < 0) {		// Content-Range: bytes */123
 		assert(crhi < 0);
 		assert(crlen > 0);
+		if (http_GetStatus(bo->beresp) == 416)
+			return (0);
 		crlo = 0;
 		crhi = crlen - 1;
 	}
diff --git a/bin/varnishtest/tests/c00034.vtc b/bin/varnishtest/tests/c00034.vtc
index df6bd6056..9f68605f1 100644
--- a/bin/varnishtest/tests/c00034.vtc
+++ b/bin/varnishtest/tests/c00034.vtc
@@ -245,6 +245,10 @@ server s1 {
 	expect req.http.range == "bytes=10-19"
 	txresp -status 206 -hdr "content-range: bytes 10-19/100" -bodylen 40
 
+	rxreq
+	expect req.http.range == "bytes=90-119"
+	txresp -status 416 -hdr "content-range: bytes */100" -bodylen 100
+
 	rxreq
 	expect req.url == "/?unexpected=content-range"
 	expect req.http.range == <undef>
@@ -279,6 +283,10 @@ client c8 {
 	rxresp
 	expect resp.status == 503
 
+	txreq -hdr "range: bytes=90-119" -hdr "return: pass"
+	rxresp
+	expect resp.status == 416
+
 	txreq -url "/?unexpected=content-range"
 	rxresp
 	expect resp.status == 503


More information about the varnish-commit mailing list