Skip to content

Commit 8f979b7

Browse files
committed
r4340: demo how we can send a GET with C-L: 0 today
1 parent 050d28b commit 8f979b7

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

bin/varnishtest/tests/r04340.vtc

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,41 @@ varnishtest "C-L with empty POST"
22

33
server s1 {
44
rxreq
5+
expect req.method == "POST"
6+
txresp
7+
expect req.http.content-length == 0
8+
9+
rxreq
10+
expect req.method == "GET"
511
txresp
612
expect req.http.content-length == 0
713
} -start
814

915
varnish v1 -vcl+backend {
10-
16+
sub vcl_backend_error {
17+
if (bereq.method == "GETCL0") {
18+
return (retry);
19+
}
20+
}
21+
sub vcl_backend_fetch {
22+
# trick to get a GET with a C-L: 0
23+
if (bereq.retries == 0 && bereq.method == "GET") {
24+
set bereq.method = "GETCL0";
25+
return (error);
26+
}
27+
else if (bereq.method == "GETCL0") {
28+
set bereq.method = "GET";
29+
}
30+
return (fetch);
31+
}
1132
} -start
1233

1334
client c1 {
1435
txreq -method POST -hdr "content-length: 0"
1536
rxresp
37+
38+
txreq -method GET -hdr "content-length: 0"
39+
rxresp
1640
} -run
1741

1842
server s1 -wait

0 commit comments

Comments
 (0)