Commit 113f2318 authored by Geoff Simmons's avatar Geoff Simmons

Partial responses to range requests (beresp.status == 206) are ignored.

As do the g(un)zip VFPs for Varnish.
parent e4d0b813
# looks like -*- vcl -*-
varnishtest "the filters ignore backend responses with status 206"
server s1 {
loop 2 {
rxreq
expect req.http.Range == "bytes=0-15"
txresp -status 206 -body "foo bar baz quux"
}
} -start
varnish v1 -arg "-p vsl_mask=+VfpAcct" -vcl+backend {
import ${vmod_brotli};
sub vcl_backend_fetch {
set bereq.http.Range = "bytes=0-15";
}
sub vcl_backend_response {
set beresp.filters = "unbr";
set beresp.uncacheable = true;
}
} -start
client c1 {
txreq -hdr "Range: bytes=0-15"
rxresp
expect resp.status == 206
expect resp.http.Content-Encoding == <undef>
expect resp.body == "foo bar baz quux"
} -run
varnish v1 -vcl+backend {
import ${vmod_brotli};
sub vcl_backend_fetch {
set bereq.http.Range = "bytes=0-15";
}
sub vcl_backend_response {
set beresp.filters = "br";
set beresp.uncacheable = true;
}
}
client c1 -run
logexpect l1 -v v1 -d 1 -g vxid -q "VfpAcct" {
expect 0 * Begin bereq
expect * = VfpAcct "unbr 0 0"
expect * = End
expect 0 * Begin bereq
expect * = VfpAcct "br 0 0"
expect * = End
} -run
......@@ -222,11 +222,12 @@ vfp_br_init(struct vfp_ctx *ctx, struct vfp_entry *ent)
CHECK_OBJ_NOTNULL(ctx, VFP_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ent, VFP_ENTRY_MAGIC);
/* XXX: cache_gzip.c has:
if (http_GetStatus(vc->resp) == 206)
/*
* Ignore partial responses to range requests (as Varnish does for
* gzip and gunzip).
*/
if (http_GetStatus(ctx->resp) == 206)
return (VFP_NULL);
What do we want to do about partial responses?
*/
if (ent->vfp == &vfp_br) {
if (http_GetHdr(ctx->resp, H_Content_Encoding, NULL))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment