[master] fd9e40dba stricter magic checks
Nils Goroll
slink at schokola.de
Sat Feb 2 13:28:23 UTC 2019
On 01/02/2019 20:06, Guillaume Quintard wrote:
>
> commit fd9e40dba9470c8e4242428a2c5ce774f754ccea
> Author: Guillaume Quintard <guillaume at varnish-software.com>
> Date: Thu Jan 31 14:22:20 2019 -0800
>
...
> @@ -692,15 +700,26 @@ VRT_r_bereq_xid(VRT_CTX)
> VCL_STRING
> VRT_r_sess_xid(VRT_CTX)
> {
> + struct sess *sp;
> + struct http *http;
> +
> CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
>
> - if (VALID_OBJ(ctx->req, REQ_MAGIC))
> - return (WS_Printf(ctx->req->http->ws, "%u",
> - VXID(ctx->req->sp->vxid)));
> + if (ctx->req) {
> + CHECK_OBJ(ctx->req, REQ_MAGIC);
> + CHECK_OBJ_NOTNULL(ctx->req->http, HTTP_MAGIC);
> + sp = ctx->req->sp;
> + http = ctx->req->http;
> + } else {
> + CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
> + CHECK_OBJ_NOTNULL(ctx->bo->bereq, HTTP_MAGIC);
> + sp = ctx->bo->sp;
> + http = ctx->bo->bereq;
> + }
>
> - CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
> - return (WS_Printf(ctx->bo->bereq->ws, "%u",
> - VXID(ctx->bo->sp->vxid)));
> + CHECK_OBJ_NOTNULL(http, HTTP_MAGIC);
> + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
> + return (WS_Printf(http->ws, "%u", VXID(sp->vxid)));
> }
Why the de-tour via http->ws and not just use ctx->ws ?
Nils
More information about the varnish-commit
mailing list