[master] 28497a92e vrg: Remove invalid no-content-range assertion

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Feb 20 07:28:09 UTC 2025


commit 28497a92ec990f8d4b9919c979b7c7e42e2044cf
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Feb 20 08:22:39 2025 +0100

    vrg: Remove invalid no-content-range assertion
    
    An unknown range unit will result in a -1 content-range length, which is
    not an error but intentional behavior from http_GetContentRange().
    
    Fixes #4276
    Closes #4277

diff --git a/bin/varnishd/cache/cache_range.c b/bin/varnishd/cache/cache_range.c
index 8bdd8e8df..2a60fa03b 100644
--- a/bin/varnishd/cache/cache_range.c
+++ b/bin/varnishd/cache/cache_range.c
@@ -273,7 +273,8 @@ VRG_CheckBo(struct busyobj *bo)
 	}
 
 	if (crlo < 0 && crhi < 0 && crlen < 0) {
-		AZ(http_GetHdr(bo->beresp, H_Content_Range, NULL));
+		VSLb(bo->vsl, SLT_Debug,
+		    "Missing content-range header or unknown range unit");
 		return (0);
 	}
 
diff --git a/bin/varnishtest/tests/r04276.vtc b/bin/varnishtest/tests/r04276.vtc
new file mode 100644
index 000000000..ad598f98a
--- /dev/null
+++ b/bin/varnishtest/tests/r04276.vtc
@@ -0,0 +1,17 @@
+varnishtest "should not crash"
+
+server s1 {
+        rxreq
+        txresp -status 206 -hdr "Content-Range: fish 0-5/68" -body "F"
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_recv {
+		return (pass);
+	}
+} -start
+
+client c1 {
+        txreq
+        rxresp
+} -run


More information about the varnish-commit mailing list