Commit 9e174d4c authored by Guillaume Quintard's avatar Guillaume Quintard

Log cacheability

parent b3691b39
......@@ -198,9 +198,10 @@ RFC2616_Ttl(struct busyobj *bo, double now, double *t_origin,
}
VSLb(bo->vsl, SLT_TTL,
"RFC %.0f %.0f %.0f %.0f %.0f %.0f %.0f %u",
"RFC %.0f %.0f %.0f %.0f %.0f %.0f %.0f %u %s",
*ttl, *grace, *keep, now,
*t_origin, h_date, h_expires, max_age);
*t_origin, h_date, h_expires, max_age,
bo->uncacheable ? "uncacheable" : "cacheable");
}
/*--------------------------------------------------------------------
......
......@@ -105,7 +105,7 @@ VRT_hit_for_pass(VRT_CTX, VCL_DURATION d)
oc->ttl = d;
oc->grace = 0.0;
oc->keep = 0.0;
VSLb(ctx->vsl, SLT_TTL, "HFP %.0f %.0f %.0f %.0f",
VSLb(ctx->vsl, SLT_TTL, "HFP %.0f %.0f %.0f %.0f uncacheable",
oc->ttl, oc->grace, oc->keep, oc->t_origin);
}
......
......@@ -229,8 +229,11 @@ VRT_r_bereq_uncacheable(VRT_CTX)
VCL_VOID
VRT_l_beresp_uncacheable(VRT_CTX, VCL_BOOL a)
{
struct objcore *oc;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
CHECK_OBJ_NOTNULL(ctx->bo->fetch_objcore, OBJCORE_MAGIC);
if (ctx->bo->uncacheable && !a) {
VSLb(ctx->vsl, SLT_VCL_Error,
......@@ -238,6 +241,11 @@ VRT_l_beresp_uncacheable(VRT_CTX, VCL_BOOL a)
} else if (a) {
ctx->bo->uncacheable = 1;
}
oc = ctx->bo->fetch_objcore;
VSLb(ctx->vsl, SLT_TTL, "VCL %.0f %.0f %.0f %.0f %s", \
oc->ttl, oc->grace, oc->keep, oc->t_origin, \
ctx->bo->uncacheable ? "uncacheable" : "cacheable");\
}
VCL_BOOL
......@@ -598,8 +606,9 @@ VRT_l_##which##_##fld(VRT_CTX, VCL_DURATION a) \
if (a < 0.0) \
a = 0.0; \
oc->fld = a; \
VSLb(ctx->vsl, SLT_TTL, "VCL %.0f %.0f %.0f %.0f", \
oc->ttl, oc->grace, oc->keep, oc->t_origin); \
VSLb(ctx->vsl, SLT_TTL, "VCL %.0f %.0f %.0f %.0f %s", \
oc->ttl, oc->grace, oc->keep, oc->t_origin, \
ctx->bo->uncacheable ? "uncacheable" : "cacheable");\
}
#define VRT_DO_EXP_R(which, oc, fld, offset) \
......
......@@ -209,25 +209,27 @@ SLTM(LostHeader, 0, "Failed attempt to set HTTP header",
SLTM(TTL, 0, "TTL set on object",
"A TTL record is emitted whenever the ttl, grace or keep"
" values for an object is set.\n\n"
" values for an object is set as well as whether the object is "
" cacheable or not.\n\n"
"The format is::\n\n"
"\t%s %d %d %d %d [ %d %d %u %u ]\n"
"\t| | | | | | | | |\n"
"\t| | | | | | | | +- Max-Age from Cache-Control header\n"
"\t| | | | | | | +---- Expires header\n"
"\t| | | | | | +------- Date header\n"
"\t| | | | | +---------- Age (incl Age: header value)\n"
"\t| | | | +--------------- Reference time for TTL\n"
"\t| | | +------------------ Keep\n"
"\t| | +--------------------- Grace\n"
"\t| +------------------------ TTL\n"
"\t+--------------------------- \"RFC\", \"VCL\" or \"HFP\"\n"
"\t%s %d %d %d %d [ %d %d %u %u ] %s\n"
"\t| | | | | | | | | |\n"
"\t| | | | | | | | | +- \"cacheable\" or \"uncacheable\"\n"
"\t| | | | | | | | +------ Max-Age from Cache-Control header\n"
"\t| | | | | | | +--------- Expires header\n"
"\t| | | | | | +------------ Date header\n"
"\t| | | | | +--------------- Age (incl Age: header value)\n"
"\t| | | | +-------------------- Reference time for TTL\n"
"\t| | | +----------------------- Keep\n"
"\t| | +-------------------------- Grace\n"
"\t| +----------------------------- TTL\n"
"\t+-------------------------------- \"RFC\", \"VCL\" or \"HFP\"\n"
"\n"
"The last four fields are only present in \"RFC\" headers.\n\n"
"The four optional fields are only present in \"RFC\" headers.\n\n"
"Examples::\n\n"
"\tRFC 60 10 -1 1312966109 1312966109 1312966109 0 60\n"
"\tVCL 120 10 0 1312966111\n"
"\tHFP 2 0 0 1312966113\n"
"\tRFC 60 10 -1 1312966109 1312966109 1312966109 0 60 cacheable\n"
"\tVCL 120 10 0 1312966111 uncacheable\n"
"\tHFP 2 0 0 1312966113 uncacheable\n"
"\n"
)
......
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