[master] 3cea894 Reduce RFC2616_Do_Cond() arg from sp to req

Poul-Henning Kamp phk at varnish-cache.org
Thu Jun 14 10:43:23 CEST 2012


commit 3cea89452d8c9b908eaf0cc4defe2a0c7c4f39fd
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Jun 14 08:43:06 2012 +0000

    Reduce RFC2616_Do_Cond() arg from sp to req

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 4319b70..03c3edf 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -1015,7 +1015,7 @@ char *WS_Snapshot(struct ws *ws);
 void RFC2616_Ttl(struct busyobj *, unsigned xid);
 enum body_status RFC2616_Body(struct busyobj *, struct dstat *);
 unsigned RFC2616_Req_Gzip(const struct http *);
-int RFC2616_Do_Cond(const struct sess *sp);
+int RFC2616_Do_Cond(const struct req *sp);
 
 /* stevedore.c */
 struct object *STV_NewObject(struct busyobj *, struct objcore **,
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index d063466..729b91b 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -880,7 +880,7 @@ cnt_fetchbody(struct sess *sp, struct worker *wrk, struct req *req)
 	 */
 	if (req->obj->response == 200 &&
 	    req->http->conds &&
-	    RFC2616_Do_Cond(sp))
+	    RFC2616_Do_Cond(req))
 		bo->do_stream = 0;
 
 	/*
diff --git a/bin/varnishd/cache/cache_response.c b/bin/varnishd/cache/cache_response.c
index 82cdafc..700e791 100644
--- a/bin/varnishd/cache/cache_response.c
+++ b/bin/varnishd/cache/cache_response.c
@@ -128,7 +128,7 @@ RES_BuildHttp(const struct sess *sp)
 		http_Unset(req->resp, H_Content_Encoding);
 
 	if (req->obj->response == 200
-	    && req->http->conds && RFC2616_Do_Cond(sp)) {
+	    && req->http->conds && RFC2616_Do_Cond(req)) {
 		req->wantbody = 0;
 		http_SetResp(req->resp, "HTTP/1.1", 304, "Not Modified");
 		http_Unset(req->resp, H_Content_Length);
diff --git a/bin/varnishd/cache/cache_rfc2616.c b/bin/varnishd/cache/cache_rfc2616.c
index ece413d..905b744 100644
--- a/bin/varnishd/cache/cache_rfc2616.c
+++ b/bin/varnishd/cache/cache_rfc2616.c
@@ -310,7 +310,7 @@ RFC2616_Req_Gzip(const struct http *hp)
 /*--------------------------------------------------------------------*/
 
 int
-RFC2616_Do_Cond(const struct sess *sp)
+RFC2616_Do_Cond(const struct req *req)
 {
 	char *p, *e;
 	double ims;
@@ -319,19 +319,19 @@ RFC2616_Do_Cond(const struct sess *sp)
 	/* RFC 2616 13.3.4 states we need to match both ETag
 	   and If-Modified-Since if present*/
 
-	if (http_GetHdr(sp->req->http, H_If_Modified_Since, &p) ) {
-		if (!sp->req->obj->last_modified)
+	if (http_GetHdr(req->http, H_If_Modified_Since, &p) ) {
+		if (!req->obj->last_modified)
 			return (0);
 		ims = VTIM_parse(p);
-		if (ims > sp->req->t_req)	/* [RFC2616 14.25] */
+		if (ims > req->t_req)	/* [RFC2616 14.25] */
 			return (0);
-		if (sp->req->obj->last_modified > ims)
+		if (req->obj->last_modified > ims)
 			return (0);
 		do_cond = 1;
 	}
 
-	if (http_GetHdr(sp->req->http, H_If_None_Match, &p) &&
-	    http_GetHdr(sp->req->obj->http, H_ETag, &e)) {
+	if (http_GetHdr(req->http, H_If_None_Match, &p) &&
+	    http_GetHdr(req->obj->http, H_ETag, &e)) {
 		if (strcmp(p,e) != 0)
 			return (0);
 		do_cond = 1;



More information about the varnish-commit mailing list