[master] ea518c6 Add a OF_IMSCAND flag at set it when we create the object, and replace the duplicated test for :status, Last-Modified and ETag.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Aug 12 10:15:04 CEST 2014
commit ea518c6930b80e24b4773e2e6039240928ff4c48
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Aug 12 08:13:44 2014 +0000
Add a OF_IMSCAND flag at set it when we create the object, and replace
the duplicated test for :status, Last-Modified and ETag.
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index b69b0c0..9dfdbc8 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -397,6 +397,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
static enum fetch_step
vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
{
+ char *p;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
@@ -483,6 +484,11 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
if (bo->do_gzip || bo->do_gunzip)
ObjSetFlag(bo->vfc, OF_CHGGZIP, 1);
+ if (http_IsStatus(bo->beresp, 200) && (
+ http_GetHdr(bo->beresp, H_Last_Modified, &p) ||
+ http_GetHdr(bo->beresp, H_ETag, &p)))
+ ObjSetFlag(bo->vfc, OF_IMSCAND, 1);
+
if (bo->htc.body_status != BS_NONE)
V1F_Setup_Fetch(bo);
@@ -865,8 +871,7 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
oldobj = ObjGetObj(oldoc, &wrk->stats);
CHECK_OBJ_NOTNULL(oldobj, OBJECT_MAGIC);
- if (http_GetHdr(oldobj->http, H_Last_Modified, NULL) ||
- http_GetHdr(oldobj->http, H_ETag, NULL)) {
+ if (ObjCheckFlag(oldoc, &req->wrk->stats, OF_IMSCAND)) {
assert(oldoc->refcnt > 0);
HSH_Ref(oldoc);
bo->ims_obj = oldobj;
diff --git a/include/tbl/obj_attr.h b/include/tbl/obj_attr.h
index 42e58e7..b121793 100644
--- a/include/tbl/obj_attr.h
+++ b/include/tbl/obj_attr.h
@@ -45,6 +45,7 @@ OBJ_ATTR(LASTMODIFIED, lastmodified)
/* upper, lower, val */
OBJ_FLAG(GZIPED, gziped, (1<<1))
OBJ_FLAG(CHGGZIP, chggzip, (1<<2))
+OBJ_FLAG(IMSCAND, imscand, (1<<3))
#endif
/*lint -restore */
More information about the varnish-commit
mailing list