varnish-cache icon indicating copy to clipboard operation
varnish-cache copied to clipboard

RFC: VCL changes to body-related headers?

Open nigoroll opened this issue 5 years ago • 1 comments

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

nigoroll avatar Apr 08 '20 16:04 nigoroll

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.

nigoroll avatar Jun 12 '20 13:06 nigoroll

Continued in #3810

nigoroll avatar Jan 23 '23 14:01 nigoroll