Commit 9bba6622 authored by Nils Goroll's avatar Nils Goroll

centralize setting ctx->syntax

... and ensure it always gets set during cli operations also
parent c67af5f5
...@@ -83,6 +83,7 @@ VCL_Bo2Ctx(struct vrt_ctx *ctx, struct busyobj *bo) ...@@ -83,6 +83,7 @@ VCL_Bo2Ctx(struct vrt_ctx *ctx, struct busyobj *bo)
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
CHECK_OBJ_NOTNULL(bo->wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo->wrk, WORKER_MAGIC);
ctx->vcl = bo->vcl; ctx->vcl = bo->vcl;
ctx->syntax = ctx->vcl->conf->syntax;
ctx->vsl = bo->vsl; ctx->vsl = bo->vsl;
ctx->http_bereq = bo->bereq; ctx->http_bereq = bo->bereq;
ctx->http_beresp = bo->beresp; ctx->http_beresp = bo->beresp;
...@@ -102,6 +103,7 @@ VCL_Req2Ctx(struct vrt_ctx *ctx, struct req *req) ...@@ -102,6 +103,7 @@ VCL_Req2Ctx(struct vrt_ctx *ctx, struct req *req)
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
ctx->vcl = req->vcl; ctx->vcl = req->vcl;
ctx->syntax = ctx->vcl->conf->syntax;
ctx->vsl = req->vsl; ctx->vsl = req->vsl;
ctx->http_req = req->http; ctx->http_req = req->http;
CHECK_OBJ_NOTNULL(req->top, REQTOP_MAGIC); CHECK_OBJ_NOTNULL(req->top, REQTOP_MAGIC);
...@@ -586,6 +588,7 @@ vcl_cancel_load(struct vrt_ctx *ctx, struct cli *cli, ...@@ -586,6 +588,7 @@ vcl_cancel_load(struct vrt_ctx *ctx, struct cli *cli,
ctx = VCL_Get_CliCtx(0); ctx = VCL_Get_CliCtx(0);
ctx->vcl = vcl; ctx->vcl = vcl;
ctx->method = VCL_MET_FINI; ctx->method = VCL_MET_FINI;
ctx->syntax = ctx->vcl->conf->syntax;
AZ(vcl_send_event(ctx, VCL_EVENT_DISCARD)); AZ(vcl_send_event(ctx, VCL_EVENT_DISCARD));
ctx->method = 0; ctx->method = 0;
vcl_KillBackends(vcl); vcl_KillBackends(vcl);
...@@ -623,6 +626,7 @@ vcl_load(struct cli *cli, struct vrt_ctx *ctx, ...@@ -623,6 +626,7 @@ vcl_load(struct cli *cli, struct vrt_ctx *ctx,
vcl->temp = VCL_TEMP_INIT; vcl->temp = VCL_TEMP_INIT;
ctx->vcl = vcl; ctx->vcl = vcl;
ctx->syntax = ctx->vcl->conf->syntax;
VSB_clear(ctx->msg); VSB_clear(ctx->msg);
ctx->method = VCL_MET_INIT; ctx->method = VCL_MET_INIT;
...@@ -801,6 +805,7 @@ vcl_cli_state(struct cli *cli, const char * const *av, void *priv) ...@@ -801,6 +805,7 @@ vcl_cli_state(struct cli *cli, const char * const *av, void *priv)
ctx = VCL_Get_CliCtx(1); ctx = VCL_Get_CliCtx(1);
ctx->vcl = vcl_find(av[2]); ctx->vcl = vcl_find(av[2]);
AN(ctx->vcl); AN(ctx->vcl);
ctx->syntax = ctx->vcl->conf->syntax;
if (vcl_set_state(ctx, av[3])) { if (vcl_set_state(ctx, av[3])) {
AZ(VSB_finish(ctx->msg)); AZ(VSB_finish(ctx->msg));
VCLI_SetResult(cli, CLIS_CANT); VCLI_SetResult(cli, CLIS_CANT);
......
...@@ -442,7 +442,6 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo, ...@@ -442,7 +442,6 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
VCL_Bo2Ctx(&ctx, bo); VCL_Bo2Ctx(&ctx, bo);
} }
assert(ctx.now != 0); assert(ctx.now != 0);
ctx.syntax = ctx.vcl->conf->syntax;
ctx.specific = specific; ctx.specific = specific;
ctx.method = method; ctx.method = method;
aws = WS_Snapshot(wrk->aws); aws = WS_Snapshot(wrk->aws);
......
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