Commit 6f43c0e9 authored by Federico G. Schwindt's avatar Federico G. Schwindt Committed by Pål Hermunn Johansen

If pipe'ing, unset any existing Connection headers

Otherwise the backend might see multiple Connection entries.
Fixes #2337.
parent 8b86c617
......@@ -584,7 +584,7 @@ cnt_pipe(struct worker *wrk, struct req *req)
HTTP_Setup(bo->bereq, bo->ws, bo->vsl, SLT_BereqMethod);
http_FilterReq(bo->bereq, req->http, 0); // XXX: 0 ?
http_PrintfHeader(bo->bereq, "X-Varnish: %u", VXID(req->vsl->wid));
http_SetHeader(bo->bereq, "Connection: close");
http_ForceHeader(bo->bereq, H_Connection, "close");
VCL_pipe_method(req->vcl, wrk, req, bo, NULL);
......
......@@ -2,17 +2,30 @@ varnishtest "Check that a pipe transaction works"
server s1 -repeat 1 {
rxreq
txresp -body "012345\n"
expect req.http.connection == "close"
txresp
rxreq
expect req.http.connection == "keep-alive"
txresp
} -start
varnish v1 -vcl+backend {
sub vcl_recv {
return(pipe);
}
sub vcl_pipe {
if (req.url == "/2") {
set bereq.http.connection = req.http.connection;
}
}
} -start
client c1 {
txreq -url "/"
txreq -url /1 -hdr "Connection: keep-alive"
rxresp
expect resp.status == 200
txreq -url /2 -hdr "Connection: keep-alive"
rxresp
expect resp.status == 200
} -run
......
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