Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
varnishtest "if-range header" | ||
|
||
server s1 { | ||
rxreq | ||
txresp -hdr {etag: "foo"} -hdr "last-modified: Wed, 21 Oct 2015 07:28:00 GMT" -bodylen 16 | ||
|
||
rxreq | ||
txresp -bodylen 16 | ||
} -start | ||
|
||
varnish v1 -vcl+backend {} -start | ||
|
||
client c1 { | ||
txreq | ||
rxresp | ||
expect resp.status == 200 | ||
expect resp.bodylen == 16 | ||
|
||
# if-range, but no range | ||
txreq -hdr {if-range: "foo"} | ||
rxresp | ||
expect resp.status == 200 | ||
expect resp.bodylen == 16 | ||
|
||
# non-matching etag if-range | ||
txreq -hdr {if-range: "fooled"} -hdr "range: bytes=5-9" | ||
rxresp | ||
expect resp.status == 200 | ||
expect resp.bodylen == 16 | ||
|
||
# matching etag if-range | ||
txreq -hdr {if-range: "foo"} -hdr "range: bytes=5-9" | ||
rxresp | ||
expect resp.status == 206 | ||
expect resp.bodylen == 5 | ||
|
||
# non-matching date if-range (past) | ||
txreq -hdr "if-range: Wed, 21 Oct 2015 07:18:00 GMT" -hdr "range: bytes=5-9" | ||
rxresp | ||
expect resp.status == 200 | ||
expect resp.bodylen == 16 | ||
|
||
# non-matching date if-range (future) | ||
txreq -hdr "if-range: Wed, 21 Oct 2015 07:38:00 GMT" -hdr "range: bytes=5-9" | ||
rxresp | ||
expect resp.status == 200 | ||
expect resp.bodylen == 16 | ||
|
||
# matching etag if-range | ||
txreq -hdr "if-range: Wed, 21 Oct 2015 07:28:00 GMT" -hdr "range: bytes=5-9" | ||
rxresp | ||
expect resp.status == 206 | ||
expect resp.bodylen == 5 | ||
}-run | ||
|
||
varnish v1 -cliok "ban obj.status != x" | ||
|
||
# no etag/LM header | ||
client c1 { | ||
txreq | ||
rxresp | ||
expect resp.status == 200 | ||
expect resp.bodylen == 16 | ||
|
||
# non-matching etag if-range | ||
txreq -hdr {if-range: "fooled"} -hdr "range: bytes=5-9" | ||
rxresp | ||
expect resp.status == 200 | ||
expect resp.bodylen == 16 | ||
|
||
# matching etag if-range | ||
txreq -hdr {if-range: "foo"} -hdr "range: bytes=5-9" | ||
rxresp | ||
expect resp.status == 200 | ||
expect resp.bodylen == 16 | ||
|
||
# non-matching date if-range (past) | ||
txreq -hdr "if-range: Wed, 21 Oct 2015 07:18:00 GMT" -hdr "range: bytes=5-9" | ||
rxresp | ||
expect resp.status == 200 | ||
expect resp.bodylen == 16 | ||
|
||
# non-matching date if-range (future) | ||
txreq -hdr "if-range: Wed, 21 Oct 2015 07:38:00 GMT" -hdr "range: bytes=5-9" | ||
rxresp | ||
expect resp.status == 200 | ||
expect resp.bodylen == 16 | ||
} -run |