Commit fd9e40db authored by Guillaume Quintard's avatar Guillaume Quintard

stricter magic checks

parent b23dddd3
......@@ -429,6 +429,10 @@ VRT_r_obj_storage(VRT_CTX)
{
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC);
CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC);
AN(ctx->req->objcore->stobj);
CHECK_OBJ_NOTNULL(ctx->req->objcore->stobj->stevedore,
STEVEDORE_MAGIC);
return (ctx->req->objcore->stobj->stevedore);
}
......@@ -673,6 +677,8 @@ VRT_r_req_xid(VRT_CTX)
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC);
CHECK_OBJ_NOTNULL(ctx->req->http, HTTP_MAGIC);
AN(ctx->req->vsl);
return (WS_Printf(ctx->req->http->ws, "%u",
VXID(ctx->req->vsl->wid)));
......@@ -684,6 +690,8 @@ VRT_r_bereq_xid(VRT_CTX)
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
CHECK_OBJ_NOTNULL(ctx->bo->bereq, HTTP_MAGIC);
AN(ctx->bo->vsl);
return (WS_Printf(ctx->bo->bereq->ws, "%u",
VXID(ctx->bo->vsl->wid)));
......@@ -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)));
}
/*--------------------------------------------------------------------
......@@ -763,9 +782,10 @@ VRT_r_local_##var(VRT_CTX) \
struct sess *sp; \
\
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \
if (VALID_OBJ(ctx->req, REQ_MAGIC)) \
if (ctx->req) { \
CHECK_OBJ(ctx->req, REQ_MAGIC); \
sp = ctx->req->sp; \
else { \
} else { \
CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); \
sp = ctx->bo->sp; \
} \
......
......@@ -67,9 +67,12 @@ get_sp(VRT_CTX)
{
struct sess *sp;
if (VALID_OBJ(ctx->req, REQ_MAGIC))
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
if (ctx->req) {
CHECK_OBJ(ctx->req, REQ_MAGIC);
sp = ctx->req->sp;
else {
} else {
CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
sp = ctx->bo->sp;
}
......
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