varnish-cache
varnish-cache copied to clipboard
RFC: VCL changes to body-related headers?
This just popped into my mind working on a somehow related issue:
Do we want to be agnostic against VCL changes to Transfer-Encoding and Content-Length and do the right thing when fetching the response, or do we rather want to allow fixups for badly behaving backends? Yet, if the latter, could we possibly know which body the backend sends without even being able to look at it?
This VTC is intended to demo the issue, it fails.
varnishtest "fiddle TE/CL"
server s1 -keepalive -repeat 2 {
rxreq
txresp -bodylen 4096
rxreq
txresp -nolen -hdr "Transfer-Encoding: chunked"
chunkedlen 4096
chunkedlen 0
} -start
varnish v1 -vcl+backend {
sub vcl_recv { return (pass); }
sub vcl_backend_response {
unset beresp.http.Transfer-Encoding;
set beresp.http.Content-Length = "0";
}
} -start
client c1 -keepalive -repeat 4 {
txreq
rxresp
expect resp.bodylen == 0
} -run
clarified with @bsdphk : The fetch should be agnostic to changes from VCL, I shall have another look and find out if there is any problem in that regard.
Continued in #3810