[master] 3fc690dfc Add test case for 304 response on zero-sized object

Nils Goroll nils.goroll at uplex.de
Mon Dec 4 10:36:06 UTC 2023


commit 3fc690dfc6c81ac2d9e96768bbe0516e8c67b75f
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Dec 4 11:30:24 2023 +0100

    Add test case for 304 response on zero-sized object
    
    Test case by Martin Blix Grydeland, taken from #4013

diff --git a/bin/varnishtest/tests/b000082.vtc b/bin/varnishtest/tests/b000082.vtc
new file mode 100644
index 000000000..8b659a913
--- /dev/null
+++ b/bin/varnishtest/tests/b000082.vtc
@@ -0,0 +1,39 @@
+varnishtest "Backend IMS 304 reponse with Content-Length 0"
+
+# this case tests invalid behaviour, which we should handle gracefully anyway
+
+server s1 {
+	rxreq
+	txresp -nolen -hdr "Content-Length: 0" -hdr {Etag: "foo"}
+
+	rxreq
+	txresp -status 304 -nolen -hdr "Content-Length: 0" -hdr {Etag: "foo"}
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_backend_response {
+		set beresp.ttl = 1s;
+	}
+} -start
+
+client c1 {
+	txreq
+	rxresp
+
+	txreq
+	rxresp
+} -run
+
+delay 1
+
+client c2 {
+	txreq
+	rxresp
+} -run
+
+delay 0.1
+
+client c3 {
+	txreq
+	rxresp
+} -run


More information about the varnish-commit mailing list