[experimental-ims] 41a9730 Remove unused cruft from the HTTP header table.

Geoff Simmons geoff at varnish-cache.org
Tue Jan 17 14:21:28 CET 2012


commit 41a9730fd0b96f2e92dafabf7bc6ce1fc3625716
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Jan 17 09:28:23 2012 +0000

    Remove unused cruft from the HTTP header table.
    
    Eliminate the HTTPH_A_DELIVER filter which only took out "Date:"
    because we always overwrite Date: anyway.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 356d138..8891f12 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -841,7 +841,7 @@ int HTC_Rx(struct http_conn *htc);
 ssize_t HTC_Read(struct worker *w, struct http_conn *htc, void *d, size_t len);
 int HTC_Complete(struct http_conn *htc);
 
-#define HTTPH(a, b, c, d, e, f, g) extern char b[];
+#define HTTPH(a, b, c) extern char b[];
 #include "tbl/http_headers.h"
 #undef HTTPH
 
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index 62108ec..df00fbc 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -1419,7 +1419,7 @@ cnt_pipe(struct sess *sp, struct worker *wrk, const struct req *req)
 	WS_Reset(wrk->ws, NULL);
 	wrk->busyobj = VBO_GetBusyObj(wrk);
 	http_Setup(wrk->busyobj->bereq, wrk->ws);
-	http_FilterHeader(sp, HTTPH_R_PIPE);
+	http_FilterHeader(sp, 0);
 
 	VCL_pipe_method(sp);
 
diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c
index f441ef2..27a648f 100644
--- a/bin/varnishd/cache/cache_http.c
+++ b/bin/varnishd/cache/cache_http.c
@@ -37,7 +37,7 @@
 
 #include "vct.h"
 
-#define HTTPH(a, b, c, d, e, f, g) char b[] = "*" a ":";
+#define HTTPH(a, b, c) char b[] = "*" a ":";
 #include "tbl/http_headers.h"
 #undef HTTPH
 
@@ -824,8 +824,8 @@ http_EstimateWS(const struct http *fm, unsigned how, uint16_t *nhd)
 			continue;
 		if (fm->hdf[u] & HDF_FILTER)
 			continue;
-#define HTTPH(a, b, c, d, e, f, g) \
-		if (((e) & how) && http_IsHdr(&fm->hd[u], (b))) \
+#define HTTPH(a, b, c) \
+		if (((c) & how) && http_IsHdr(&fm->hd[u], (b))) \
 			continue;
 #include "tbl/http_headers.h"
 #undef HTTPH
@@ -853,8 +853,8 @@ http_FilterFields(struct worker *w, unsigned vsl_id, struct http *to,
 			continue;
 		if (fm->hdf[u] & HDF_FILTER)
 			continue;
-#define HTTPH(a, b, c, d, e, f, g) \
-		if (((e) & how) && http_IsHdr(&fm->hd[u], (b))) \
+#define HTTPH(a, b, c) \
+		if (((c) & how) && http_IsHdr(&fm->hd[u], (b))) \
 			continue;
 #include "tbl/http_headers.h"
 #undef HTTPH
@@ -1114,7 +1114,7 @@ void
 HTTP_Init(void)
 {
 
-#define HTTPH(a, b, c, d, e, f, g) b[0] = (char)strlen(b + 1);
+#define HTTPH(a, b, c) b[0] = (char)strlen(b + 1);
 #include "tbl/http_headers.h"
 #undef HTTPH
 }
diff --git a/bin/varnishd/cache/cache_response.c b/bin/varnishd/cache/cache_response.c
index dc3bdc2..3a19d4a 100644
--- a/bin/varnishd/cache/cache_response.c
+++ b/bin/varnishd/cache/cache_response.c
@@ -119,7 +119,7 @@ RES_BuildHttp(const struct sess *sp)
 	req->resp->logtag = HTTP_Tx;
 	http_CopyResp(req->resp, req->obj->http);
 	http_FilterFields(sp->wrk, sp->vsl_id, req->resp,
-	    req->obj->http, HTTPH_A_DELIVER);
+	    req->obj->http, 0);
 
 	if (!(sp->wrk->res_mode & RES_LEN)) {
 		http_Unset(req->resp, H_Content_Length);
diff --git a/include/tbl/http_headers.h b/include/tbl/http_headers.h
index afb463c..503c5c3 100644
--- a/include/tbl/http_headers.h
+++ b/include/tbl/http_headers.h
@@ -30,11 +30,7 @@
  * ---------------------------------------
  * a	Http header name
  * b	session field name
- * c	Request(1)/Response(2) bitfield
- * d	(obsolete)
- * e	Supress header in filter ops
- * f	unused
- * g	unused
+ * c	Supress header in filter ops
  *
  * see [RFC2616 13.5.1 End-to-end and Hop-by-hop Headers]
  *
@@ -44,60 +40,57 @@
 
 #ifndef HTTPH_R_PASS
 #define HTTPH_R_PASS	(1 << 0)	/* Request (c->b) in pass mode */
-#define HTTPH_A_PASS	(1 << 1)	/* Response (b->c)in pass mode */
-#define HTTPH_R_PIPE	(1 << 2)	/* Request (c->b) in pipe mode */
-#define HTTPH_R_FETCH	(1 << 3)	/* Request (c->b) for fetch */
-#define HTTPH_A_INS	(1 << 4)	/* Response (b->o) for insert */
-#define HTTPH_A_DELIVER	(1 << 5)	/* Response (o->c) for deliver */
+#define HTTPH_R_FETCH	(1 << 1)	/* Request (c->b) for fetch */
+#define HTTPH_A_INS	(1 << 2)	/* Response (b->o) for insert */
 #endif
 
-HTTPH("Keep-Alive",		H_Keep_Alive,		3, 3, HTTPH_R_PASS | HTTPH_A_PASS | HTTPH_R_FETCH,					0, 0)	/* RFC2068 */
-HTTPH("Accept",			H_Accept,		1, 0, 0,										0, 0)	/* RFC2616 14.1 */
-HTTPH("Accept-Charset",		H_Accept_Charset,	1, 0, 0,										0, 0)	/* RFC2616 14.2 */
-HTTPH("Accept-Encoding",	H_Accept_Encoding,	1, 0, 0,										0, 0)	/* RFC2616 14.3 */
-HTTPH("Accept-Language",	H_Accept_Language,	1, 0, 0,										0, 0)	/* RFC2616 14.4 */
-HTTPH("Accept-Ranges",		H_Accept_Ranges,	2, 3,				    HTTPH_R_FETCH | HTTPH_A_INS,			0, 0)	/* RFC2616 14.5 */
-HTTPH("Age",			H_Age,			2, 0,						    HTTPH_A_INS,			0, 0)	/* RFC2616 14.6 */
-HTTPH("Allow",			H_Allow,		2, 0, 0,										0, 0)	/* RFC2616 14.7 */
-HTTPH("Authorization",		H_Authorization,	1, 0, 0,										0, 0)	/* RFC2616 14.8 */
-HTTPH("Cache-Control",		H_Cache_Control,	3, 3,				    HTTPH_R_FETCH,					0, 0)	/* RFC2616 14.9 */
-HTTPH("Connection",		H_Connection,		3, 3, HTTPH_R_PASS | HTTPH_A_PASS | HTTPH_R_FETCH | HTTPH_A_INS,			0, 0)	/* RFC2616 14.10 */
-HTTPH("Content-Encoding",	H_Content_Encoding,	2, 0, 0,										0, 0)	/* RFC2616 14.11 */
-HTTPH("Content-Langugae",	H_Content_Language,	2, 0, 0,										0, 0)	/* RFC2616 14.12 */
-HTTPH("Content-Length",		H_Content_Length,	2, 2,				    HTTPH_R_FETCH | HTTPH_A_INS,			0, 0)	/* RFC2616 14.13 */
-HTTPH("Content-Location",	H_Content_Location,	2, 0, 0,										0, 0)	/* RFC2616 14.14 */
-HTTPH("Content-MD5",		H_Content_MD5,		2, 0, 0,										0, 0)	/* RFC2616 14.15 */
-HTTPH("Content-Range",		H_Content_Range,	2, 3,				    HTTPH_R_FETCH | HTTPH_A_INS,			0, 0)	/* RFC2616 14.16 */
-HTTPH("Content-Type",		H_Content_Type,		2, 0, 0,										0, 0)	/* RFC2616 14.17 */
-HTTPH("Date",			H_Date,			2, 0,								HTTPH_A_DELIVER,	0, 0)	/* RFC2616 14.18 */
-HTTPH("ETag",			H_ETag,			2, 0, 0,										0, 0)	/* RFC2616 14.19 */
-HTTPH("Expect",			H_Expect,		1, 0, 0,										0, 0)	/* RFC2616 14.20 */
-HTTPH("Expires",		H_Expires,		2, 0, 0,										0, 0)	/* RFC2616 14.21 */
-HTTPH("From",			H_From,			1, 0, 0,										0, 0)	/* RFC2616 14.22 */
-HTTPH("Host",			H_Host,			1, 0, 0,										0, 0)	/* RFC2616 14.23 */
-HTTPH("If-Match",		H_If_Match,		1, 1,				    HTTPH_R_FETCH,					0, 0)	/* RFC2616 14.24 */
-HTTPH("If-Modified-Since",	H_If_Modified_Since,	1, 1,				    HTTPH_R_FETCH,					0, 0)	/* RFC2616 14.25 */
-HTTPH("If-None-Match",		H_If_None_Match,	1, 1,				    HTTPH_R_FETCH,					0, 0)	/* RFC2616 14.26 */
-HTTPH("If-Range",		H_If_Range,		1, 1,				    HTTPH_R_FETCH,					0, 0)	/* RFC2616 14.27 */
-HTTPH("If-Unmodified-Since",	H_If_Unmodifed_Since,	1, 1,				    HTTPH_R_FETCH,					0, 0)	/* RFC2616 14.28 */
-HTTPH("Last-Modified",		H_Last_Modified,	2, 0, 0,										0, 0)	/* RFC2616 14.29 */
-HTTPH("Location",		H_Location,		2, 0, 0,										0, 0)	/* RFC2616 14.30 */
-HTTPH("Max-Forwards",		H_Max_Forwards,		1, 0, 0,										0, 0)	/* RFC2616 14.31 */
-HTTPH("Pragma",			H_Pragma,		1, 0, 0,										0, 0)	/* RFC2616 14.32 */
-HTTPH("Proxy-Authenticate",	H_Proxy_Authenticate,	2, 3,				    HTTPH_R_FETCH | HTTPH_A_INS,			0, 0)	/* RFC2616 14.33 */
-HTTPH("Proxy-Authorization",	H_Proxy_Authorization,	1, 3,				    HTTPH_R_FETCH | HTTPH_A_INS,			0, 0)	/* RFC2616 14.34 */
-HTTPH("Range",			H_Range,		1, 0,				    HTTPH_R_FETCH | HTTPH_A_INS,			0, 0)	/* RFC2616 14.35 */
-HTTPH("Referer",		H_Referer,		1, 0, 0,										0, 0)	/* RFC2616 14.36 */
-HTTPH("Retry-After",		H_Retry_After,		2, 0, 0,										0, 0)	/* RFC2616 14.37 */
-HTTPH("Server",			H_Server,		2, 0, 0,										0, 0)	/* RFC2616 14.38 */
-HTTPH("TE",			H_TE,			1, 3, HTTPH_R_PASS | HTTPH_A_PASS | HTTPH_R_FETCH | HTTPH_A_INS,			0, 0)	/* RFC2616 14.39 */
-HTTPH("Trailer",		H_Trailer,		1, 3, HTTPH_R_PASS | HTTPH_A_PASS | HTTPH_R_FETCH | HTTPH_A_INS,			0, 0)	/* RFC2616 14.40 */
-HTTPH("Transfer-Encoding",	H_Transfer_Encoding,	2, 3, HTTPH_R_PASS | HTTPH_A_PASS | HTTPH_R_FETCH | HTTPH_A_INS,			0, 0)	/* RFC2616 14.41 */
-HTTPH("Upgrade",		H_Upgrade,		2, 3, HTTPH_R_PASS | HTTPH_A_PASS | HTTPH_R_FETCH | HTTPH_A_INS,			0, 0)	/* RFC2616 14.42 */
-HTTPH("User-Agent",		H_User_Agent,		1, 0, 0,										0, 0)	/* RFC2616 14.43 */
-HTTPH("Vary",			H_Vary,			2, 0, 0,										0, 0)	/* RFC2616 14.44 */
-HTTPH("Via",			H_Via,			2, 0, 0,										0, 0)	/* RFC2616 14.45 */
-HTTPH("Warning",		H_Warning,		2, 0, 0,										0, 0)	/* RFC2616 14.46 */
-HTTPH("WWW-Authenticate",	H_WWW_Authenticate,	2, 0, 0,										0, 0)	/* RFC2616 14.47 */
+HTTPH("Keep-Alive",		H_Keep_Alive,		HTTPH_R_PASS | HTTPH_R_FETCH		  )	/* RFC2068 */
+HTTPH("Accept",			H_Accept,		0					  )	/* RFC2616 14.1 */
+HTTPH("Accept-Charset",		H_Accept_Charset,	0					  )	/* RFC2616 14.2 */
+HTTPH("Accept-Encoding",	H_Accept_Encoding,	0					  )	/* RFC2616 14.3 */
+HTTPH("Accept-Language",	H_Accept_Language,	0					  )	/* RFC2616 14.4 */
+HTTPH("Accept-Ranges",		H_Accept_Ranges,		       HTTPH_R_FETCH | HTTPH_A_INS)	/* RFC2616 14.5 */
+HTTPH("Age",			H_Age,						       HTTPH_A_INS)	/* RFC2616 14.6 */
+HTTPH("Allow",			H_Allow,		0					  )	/* RFC2616 14.7 */
+HTTPH("Authorization",		H_Authorization,	0					  )	/* RFC2616 14.8 */
+HTTPH("Cache-Control",		H_Cache_Control,		       HTTPH_R_FETCH		  )	/* RFC2616 14.9 */
+HTTPH("Connection",		H_Connection,		HTTPH_R_PASS | HTTPH_R_FETCH | HTTPH_A_INS)	/* RFC2616 14.10 */
+HTTPH("Content-Encoding",	H_Content_Encoding,	0					  )	/* RFC2616 14.11 */
+HTTPH("Content-Langugae",	H_Content_Language,	0					  )	/* RFC2616 14.12 */
+HTTPH("Content-Length",		H_Content_Length,		       HTTPH_R_FETCH | HTTPH_A_INS)	/* RFC2616 14.13 */
+HTTPH("Content-Location",	H_Content_Location,	0					  )	/* RFC2616 14.14 */
+HTTPH("Content-MD5",		H_Content_MD5,		0					  )	/* RFC2616 14.15 */
+HTTPH("Content-Range",		H_Content_Range,		       HTTPH_R_FETCH | HTTPH_A_INS)	/* RFC2616 14.16 */
+HTTPH("Content-Type",		H_Content_Type,		0					  )	/* RFC2616 14.17 */
+HTTPH("Date",			H_Date,			0					  )	/* RFC2616 14.18 */
+HTTPH("ETag",			H_ETag,			0					  )	/* RFC2616 14.19 */
+HTTPH("Expect",			H_Expect,		0					  )	/* RFC2616 14.20 */
+HTTPH("Expires",		H_Expires,		0					  )	/* RFC2616 14.21 */
+HTTPH("From",			H_From,			0					  )	/* RFC2616 14.22 */
+HTTPH("Host",			H_Host,			0					  )	/* RFC2616 14.23 */
+HTTPH("If-Match",		H_If_Match,			       HTTPH_R_FETCH		  )	/* RFC2616 14.24 */
+HTTPH("If-Modified-Since",	H_If_Modified_Since,		       HTTPH_R_FETCH		  )	/* RFC2616 14.25 */
+HTTPH("If-None-Match",		H_If_None_Match,		       HTTPH_R_FETCH		  )	/* RFC2616 14.26 */
+HTTPH("If-Range",		H_If_Range,			       HTTPH_R_FETCH		  )	/* RFC2616 14.27 */
+HTTPH("If-Unmodified-Since",	H_If_Unmodifed_Since,		       HTTPH_R_FETCH		  )	/* RFC2616 14.28 */
+HTTPH("Last-Modified",		H_Last_Modified,	0					  )	/* RFC2616 14.29 */
+HTTPH("Location",		H_Location,		0					  )	/* RFC2616 14.30 */
+HTTPH("Max-Forwards",		H_Max_Forwards,		0					  )	/* RFC2616 14.31 */
+HTTPH("Pragma",			H_Pragma,		0					  )	/* RFC2616 14.32 */
+HTTPH("Proxy-Authenticate",	H_Proxy_Authenticate,		       HTTPH_R_FETCH | HTTPH_A_INS)	/* RFC2616 14.33 */
+HTTPH("Proxy-Authorization",	H_Proxy_Authorization,		       HTTPH_R_FETCH | HTTPH_A_INS)	/* RFC2616 14.34 */
+HTTPH("Range",			H_Range,			       HTTPH_R_FETCH | HTTPH_A_INS)	/* RFC2616 14.35 */
+HTTPH("Referer",		H_Referer,		0					  )	/* RFC2616 14.36 */
+HTTPH("Retry-After",		H_Retry_After,		0					  )	/* RFC2616 14.37 */
+HTTPH("Server",			H_Server,		0					  )	/* RFC2616 14.38 */
+HTTPH("TE",			H_TE,			HTTPH_R_PASS | HTTPH_R_FETCH | HTTPH_A_INS)	/* RFC2616 14.39 */
+HTTPH("Trailer",		H_Trailer,		HTTPH_R_PASS | HTTPH_R_FETCH | HTTPH_A_INS)	/* RFC2616 14.40 */
+HTTPH("Transfer-Encoding",	H_Transfer_Encoding,	HTTPH_R_PASS | HTTPH_R_FETCH | HTTPH_A_INS)	/* RFC2616 14.41 */
+HTTPH("Upgrade",		H_Upgrade,		HTTPH_R_PASS | HTTPH_R_FETCH | HTTPH_A_INS)	/* RFC2616 14.42 */
+HTTPH("User-Agent",		H_User_Agent,		0					  )	/* RFC2616 14.43 */
+HTTPH("Vary",			H_Vary,			0					  )	/* RFC2616 14.44 */
+HTTPH("Via",			H_Via,			0					  )	/* RFC2616 14.45 */
+HTTPH("Warning",		H_Warning,		0					  )	/* RFC2616 14.46 */
+HTTPH("WWW-Authenticate",	H_WWW_Authenticate,	0					  )	/* RFC2616 14.47 */
 
 /*lint -restore */



More information about the varnish-commit mailing list