Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move synth reason between workspaces from vcl_pipe #3330

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions bin/varnishd/cache/cache_req_fsm.c
Expand Up @@ -735,6 +735,14 @@ cnt_pipe(struct worker *wrk, struct req *req)
switch (wrk->handling) {
case VCL_RET_SYNTH:
req->req_step = R_STP_SYNTH;
if (req->err_reason != NULL &&
WS_Inside(bo->ws, req->err_reason, NULL)) {
req->err_reason = WS_Copy(req->ws, req->err_reason, -1);
if (req->err_reason == NULL) {
VSLb(req->vsl, SLT_Error, "Out of workspace");
req->req_step = R_STP_VCLFAIL;
}
}
nxt = REQ_FSM_MORE;
break;
case VCL_RET_PIPE:
Expand Down
24 changes: 24 additions & 0 deletions bin/varnishtest/tests/r03329.vtc
@@ -0,0 +1,24 @@
varnishtest "Return synth from vcl_pipe with computed reason"

varnish v1 -vcl {
import vtc;
backend be none;
sub vcl_pipe {
if (req.method == "OVERFLOW") {
vtc.workspace_alloc(client, -5);
}
return (synth(405, req.method + " not allowed"));
}
} -start

client c1 {
txreq -method TEST
rxresp
expect resp.status == 405
expect resp.reason == "TEST not allowed"

txreq -method OVERFLOW
rxresp
expect resp.status == 503
expect resp.reason == "VCL failed"
} -run