[master] fce2ff2 Handle return(synth()) in vcl_pipe
PÃ¥l Hermunn Johansen
hermunn at varnish-software.com
Mon Apr 11 13:38:03 CEST 2016
commit fce2ff230ebb20f04c8a42e14792f9274b8fd53b
Author: Pål Hermunn Johansen <hermunn at varnish-software.com>
Date: Tue Apr 5 11:39:30 2016 +0200
Handle return(synth()) in vcl_pipe
Instead of panicking on a return(synth()) in vcl_pipe, we just proceed
to a normal synth.
Test by Dridi
Fixes #1890
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 321a47a..889cf40 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -569,6 +569,7 @@ static enum req_fsm_nxt
cnt_pipe(struct worker *wrk, struct req *req)
{
struct busyobj *bo;
+ enum req_fsm_nxt nxt;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
@@ -588,15 +589,22 @@ cnt_pipe(struct worker *wrk, struct req *req)
VCL_pipe_method(req->vcl, wrk, req, bo, NULL);
- if (wrk->handling == VCL_RET_SYNTH)
- INCOMPL();
- assert(wrk->handling == VCL_RET_PIPE);
-
- SES_Close(req->sp, VDI_Http1Pipe(req, bo));
+ switch (wrk->handling) {
+ case VCL_RET_SYNTH:
+ req->req_step = R_STP_SYNTH;
+ nxt = REQ_FSM_MORE;
+ break;
+ case VCL_RET_PIPE:
+ SES_Close(req->sp, VDI_Http1Pipe(req, bo));
+ nxt = REQ_FSM_DONE;
+ break;
+ default:
+ WRONG("Illegal return from vcl_pipe{}");
+ }
http_Teardown(bo->bereq);
VBO_ReleaseBusyObj(wrk, &bo);
THR_SetBusyobj(NULL);
- return (REQ_FSM_DONE);
+ return (nxt);
}
/*--------------------------------------------------------------------
diff --git a/bin/varnishtest/tests/r01890.vtc b/bin/varnishtest/tests/r01890.vtc
new file mode 100644
index 0000000..6403c13
--- /dev/null
+++ b/bin/varnishtest/tests/r01890.vtc
@@ -0,0 +1,16 @@
+server s1 {
+ rxreq
+ txresp
+} -start
+
+varnish v1 -vcl+backend {
+ sub vcl_pipe {
+ return (synth(401));
+ }
+} -start
+
+client c1 {
+ txreq -req PROPFIND
+ rxresp
+ expect resp.status == 401
+} -run
More information about the varnish-commit
mailing list