Skip to content

Commit 3b56954

Browse files
committed
condfetch: Check stale_oc bans before and after revalidation
Unlike a purge, ban processing is deferred until the next lookup, or ban lurker batch. Considering the windows between a cache lookup and either the beginning (or restart) of a fetch task, or the retrieval of a 304 response, banning an object may not result in preventing a condfetch off an invalid stale object. This is especially true for object-based bans, that are not evaluated by the ban lurker until at least ban_lurker_age seconds.
1 parent 46cdfce commit 3b56954

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

bin/varnishd/cache/cache_fetch.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ vbf_stp_mkbereq(struct worker *wrk, struct busyobj *bo)
269269
}
270270
http_ForceField(bo->bereq0, HTTP_HDR_PROTO, "HTTP/1.1");
271271

272+
if (bo->stale_oc != NULL)
273+
HSH_CheckBans(wrk, bo->stale_oc);
274+
272275
if (bo->stale_oc != NULL && !(bo->stale_oc->flags & OC_F_DYING) &&
273276
ObjCheckFlag(bo->wrk, bo->stale_oc, OF_IMSCAND) &&
274277
(bo->stale_oc->boc != NULL || ObjGetLen(wrk, bo->stale_oc) != 0)) {
@@ -835,6 +838,8 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
835838
stale_oc = bo->stale_oc;
836839
CHECK_OBJ_NOTNULL(stale_oc, OBJCORE_MAGIC);
837840

841+
HSH_CheckBans(wrk, stale_oc);
842+
838843
if (stale_oc->flags & OC_F_DYING) {
839844
(void)VFP_Error(bo->vfc, "Template object invalidated");
840845
vbf_cleanup(bo);

0 commit comments

Comments
 (0)