Commit 20181ddd authored by Nils Goroll's avatar Nils Goroll

Assign default storage for vcl_backend_error

Creating "backend synthetic" content was impossible whenever a fetch
had already started, unless storage was assigned (again) explicitly
from VCL.

Fixes #2494
parent 91c675e7
......@@ -764,6 +764,9 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
if (bo->fetch_objcore->stobj->stevedore != NULL)
ObjFreeObj(bo->wrk, bo->fetch_objcore);
if (bo->storage == NULL)
bo->storage = STV_next();
// XXX: reset all beresp flags ?
HTTP_Setup(bo->beresp, bo->ws, bo->vsl, SLT_BerespMethod);
......
varnishtest "vcl_back_backend_error default storage"
server s1 {
rxreq
txresp -nolen -hdr "Content-Length: 10240" -body 1024
} -start
varnish v1 -vcl+backend {
sub vcl_backend_response {
set beresp.do_stream = false;
}
sub vcl_backend_error {
set beresp.status = 200;
set beresp.ttl = 1h;
return (deliver);
}
} -start
client c1 {
txreq -url "/"
rxresp
expect resp.status == 200
} -run
client c2 {
txreq -url "/"
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