Commit 61c19388 authored by Reza Naghibi's avatar Reza Naghibi

Fix shard director in pipe mode

Switch the ctx and workspace to the req when resolving in pipe mode.
parent 911d2b8c
......@@ -352,7 +352,7 @@ vbe_dir_http1pipe(const struct director *d, struct req *req, struct busyobj *bo)
v1a.req = req->acct.req_hdrbytes;
req->acct.req_hdrbytes = 0;
req->res_mode = RES_PIPE;
assert(req->res_mode & RES_PIPE);
pfd = vbe_dir_getfd(req->wrk, bp, bo, 0);
......
......@@ -193,8 +193,11 @@ VDI_Http1Pipe(struct req *req, struct busyobj *bo)
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
req->res_mode = RES_PIPE;
d = vdi_resolve(req->wrk, bo);
if (d == NULL || d->http1pipe == NULL) {
req->res_mode = 0;
VSLb(bo->vsl, SLT_VCL_Error, "Backend does not support pipe");
return (SC_TX_ERROR);
}
......
......@@ -759,7 +759,13 @@ vmod_shard_resolve(const struct director *dir, struct worker *wrk,
ctx->sp = bo->sp;
ctx->now = bo->t_prev;
ctx->ws = bo->ws;
ctx->method = VCL_MET_BACKEND_FETCH;
if (bo->req) {
CHECK_OBJ_NOTNULL(bo->req, REQ_MAGIC);
if (bo->req->res_mode & RES_PIPE) {
ctx->req = bo->req;
ctx->ws = ctx->req->ws;
}
}
pp = vmod_shard_param_read(ctx, vshard,
vshard->param, pstk, "shard_resolve");
......
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