Unverified Commit 33ad6de7 authored by Reza Naghibi's avatar Reza Naghibi Committed by Nils Goroll

Move bereq.http to req->ws for vcl_pipe

Also make sure we didn't overflow before entering vcl_pipe. This would
mean we have lost important connection headers.
parent f4e21600
......@@ -745,7 +745,7 @@ cnt_pipe(struct worker *wrk, struct req *req)
bo->sp = req->sp;
SES_Ref(bo->sp);
HTTP_Setup(bo->bereq, bo->ws, bo->vsl, SLT_BereqMethod);
HTTP_Setup(bo->bereq, req->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_ForceHeader(bo->bereq, H_Connection, "close");
......@@ -756,7 +756,10 @@ cnt_pipe(struct worker *wrk, struct req *req)
}
bo->wrk = wrk;
VCL_pipe_method(req->vcl, wrk, req, bo, NULL);
if (WS_Overflowed(req->ws))
wrk->handling = VCL_RET_FAIL;
else
VCL_pipe_method(req->vcl, wrk, req, bo, NULL);
switch (wrk->handling) {
case VCL_RET_SYNTH:
......
......@@ -3,11 +3,20 @@ varnishtest "Lost reason from pipe to synth"
server s1 {} -start
varnish v1 -vcl+backend {
import vtc;
sub vcl_recv {
if (req.http.workspace) {
vtc.workspace_alloc(client, -10);
}
return (pipe);
}
sub vcl_pipe {
return (synth(505, req.http.foo + "/bar"));
if (req.http.foo) {
return (synth(505, req.http.foo + "/bar"));
} else {
set bereq.http.baz = "baz";
return (synth(505, bereq.http.baz));
}
}
} -start
......@@ -15,4 +24,12 @@ client c1 {
txreq -hdr "foo: foo"
rxresp
expect resp.reason == "foo/bar"
txreq
rxresp
expect resp.reason == "baz"
txreq -hdr "workspace: true"
rxresp
expect resp.status == 503
} -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