[master] d0d200778 Remove the http->conds microoptimization, it does not save anything any more.

Poul-Henning Kamp phk at FreeBSD.org
Thu Dec 13 11:20:11 UTC 2018


commit d0d200778cfffd08e7bc439be073426ab4062bfa
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Dec 13 11:18:53 2018 +0000

    Remove the http->conds microoptimization, it does not save anything
    any more.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index f6925ea82..86db641dc 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -165,7 +165,6 @@ struct http {
 	struct ws		*ws;
 	uint16_t		status;
 	uint8_t			protover;
-	uint8_t			conds;		/* If-* headers present */
 };
 
 /*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index 3169274a3..a4aeb584b 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -142,7 +142,6 @@ ved_include(struct req *preq, const char *src, const char *host,
 
 	HTTP_Setup(req->http, req->ws, req->vsl, SLT_ReqMethod);
 	HTTP_Copy(req->http, preq->http);
-	req->http->conds = 0;
 
 	http_SetH(req->http, HTTP_HDR_URL, src);
 	if (host != NULL && *host != '\0')  {
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 66b1d4fa1..05d5339f4 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -182,9 +182,7 @@ cnt_deliver(struct worker *wrk, struct req *req)
 
 	assert(wrk->handling == VCL_RET_DELIVER);
 
-	if (IS_TOPREQ(req) &&
-	    http_IsStatus(req->resp, 200) &&
-	    req->http->conds && RFC2616_Do_Cond(req))
+	if (IS_TOPREQ(req) && RFC2616_Do_Cond(req))
 		http_PutResponse(req->resp, "HTTP/1.1", 304, NULL);
 
 	req->req_step = R_STP_TRANSMIT;
diff --git a/bin/varnishd/cache/cache_rfc2616.c b/bin/varnishd/cache/cache_rfc2616.c
index c9341fdd0..bd5ed88c6 100644
--- a/bin/varnishd/cache/cache_rfc2616.c
+++ b/bin/varnishd/cache/cache_rfc2616.c
@@ -260,6 +260,9 @@ RFC2616_Do_Cond(const struct req *req)
 	const char *p, *e;
 	vtim_real ims, lm;
 
+	if (!http_IsStatus(req->resp, 200))
+		return (0);
+
 	/*
 	 * We MUST ignore If-Modified-Since if we have an If-None-Match
 	 * header [RFC7232 3.3 p16].
diff --git a/bin/varnishd/http1/cache_http1_proto.c b/bin/varnishd/http1/cache_http1_proto.c
index dd81863d3..15090bdcf 100644
--- a/bin/varnishd/http1/cache_http1_proto.c
+++ b/bin/varnishd/http1/cache_http1_proto.c
@@ -115,7 +115,6 @@ http1_dissect_hdrs(struct http *hp, char *p, struct http_conn *htc,
 	assert(p > htc->rxbuf_b);
 	assert(p <= htc->rxbuf_e);
 	hp->nhd = HTTP_HDR_FIRST;
-	hp->conds = 0;
 	r = NULL;		/* For FlexeLint */
 	for (; p < htc->rxbuf_e; p = r) {
 
@@ -173,11 +172,6 @@ http1_dissect_hdrs(struct http *hp, char *p, struct http_conn *htc,
 			return (400);
 		}
 
-		if ((p[0] == 'i' || p[0] == 'I') &&
-		    (p[1] == 'f' || p[1] == 'F') &&
-		    p[2] == '-')
-			hp->conds = 1;
-
 		while (q > p && vct_issp(q[-1]))
 			q--;
 		*q = '\0';
diff --git a/bin/varnishd/http2/cache_http2_proto.c b/bin/varnishd/http2/cache_http2_proto.c
index 76046d92f..8915e1498 100644
--- a/bin/varnishd/http2/cache_http2_proto.c
+++ b/bin/varnishd/http2/cache_http2_proto.c
@@ -535,7 +535,6 @@ h2_do_req(struct worker *wrk, void *priv)
 	CAST_OBJ_NOTNULL(r2, req->transport_priv, H2_REQ_MAGIC);
 	THR_SetRequest(req);
 
-	req->http->conds = 1;
 	wrk->stats->client_req++;
 	if (CNT_Request(wrk, req) != REQ_FSM_DISEMBARK) {
 		AZ(req->ws->r);


More information about the varnish-commit mailing list