Page MenuHomePhabricator
Paste P6193

(An Untitled Masterwork)
ActivePublic

Authored by ema on Oct 26 2017, 1:07 PM.
Tags
None
Referenced Files
F10447423:
Oct 26 2017, 1:07 PM
Subscribers
None
varnishtest "CL set with do_stream=false"
server s1 {
loop 3 {
rxreq
txresp -nolen -hdr "Transfer-encoding: chunked"
delay .2
chunkedlen 42
delay .2
chunkedlen 0
}
} -start
varnish v2 -vcl+backend {
sub vcl_backend_response {
if (bereq.url == "/3") {
set beresp.do_stream = false;
// to check if we've been here
set beresp.http.X-v2-rocks = "maybe";
if (beresp.http.Content-Length) {
set beresp.http.X-v2-CL = beresp.http.Content-Length;
}
}
}
} -start
varnish v1 -vcl {
backend b {
.host = "${v2_addr}";
.port = "${v2_port}";
}
sub vcl_backend_response {
if (bereq.url == "/2") {
set beresp.do_stream = false;
}
if (bereq.url == "/3") {
if (beresp.http.Content-Length) {
set beresp.http.X-v1-CL = beresp.http.Content-Length;
}
}
}
} -start
client c1 {
txreq -url "/1"
rxresp
expect resp.http.Content-Length == <undef>
txreq -url "/2"
rxresp
expect resp.http.Content-Length == 42
txreq -url "/3"
rxresp
expect resp.http.Content-Length == 42
expect resp.http.X-v2-rocks == "maybe"
expect resp.http.X-v2-CL == <undef>
expect resp.http.X-v1-CL == resp.http.Content-Length
} -run