Commit f3c8cd4d authored by Nils Goroll's avatar Nils Goroll Committed by Dridi Boukelmoune

fix proxy backend in pipe mode

Fixes #2613
parent 861f8f49
......@@ -693,6 +693,8 @@ cnt_pipe(struct worker *wrk, struct req *req)
VSLb(bo->vsl, SLT_Begin, "bereq %u pipe", VXID(req->vsl->wid));
VSLb(req->vsl, SLT_Link, "bereq %u pipe", VXID(bo->vsl->wid));
THR_SetBusyobj(bo);
bo->sp = req->sp;
SES_Ref(bo->sp);
HTTP_Setup(bo->bereq, bo->ws, bo->vsl, SLT_BereqMethod);
http_FilterReq(bo->bereq, req->http, 0); // XXX: 0 ?
......@@ -726,6 +728,7 @@ cnt_pipe(struct worker *wrk, struct req *req)
WRONG("Illegal return from vcl_pipe{}");
}
http_Teardown(bo->bereq);
SES_Rel(bo->sp);
VBO_ReleaseBusyObj(wrk, &bo);
THR_SetBusyobj(NULL);
return (nxt);
......
......@@ -34,6 +34,13 @@ server s1 {
expect req.http.xyzzy1 == 4444
expect req.http.x-forwarded-for == "1:f::2, 1:f::2"
txresp -body "proxy4"
rxreq
expect req.url == "/pipe"
expect req.http.xyzzy1 == req.http.xyzzy2
expect req.http.xyzzy1 == 5555
expect req.http.x-forwarded-for == "1:f::2, 1:f::2"
txresp -hdr "Connection: close" -body "pipe"
} -start
varnish v1 -proto PROXY -vcl+backend {
......@@ -64,6 +71,9 @@ varnish v2 -proto PROXY -vcl {
} else {
set req.backend_hint = bp2;
}
if (req.url ~ "^/pipe") {
return (pipe);
}
}
sub vcl_deliver {
set resp.http.connection = "close";
......@@ -97,3 +107,11 @@ client c1 -connect ${v2_sock} -proxy1 "[1:f::2]:4444 [5:a::8]:5678" {
expect resp.body == "proxy4"
} -run
delay .2
client c1 -connect ${v2_sock} -proxy1 "[1:f::2]:5555 [5:a::8]:5678" {
txreq -url /pipe
rxresp
expect resp.body == "pipe"
expect resp.http.Connection == "close"
expect_close
} -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