[experimental-ims] 8b98c9e Move more table-generating #includes into tbl/ subdir

Geoff Simmons geoff at varnish-cache.org
Mon Jan 9 21:52:14 CET 2012


commit 8b98c9ed9befa096e2fe0b862ed9720a71e33646
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Sat Oct 8 14:43:13 2011 +0000

    Move more table-generating #includes into tbl/ subdir

diff --git a/bin/varnishd/cache.h b/bin/varnishd/cache.h
index 11e952e..f46634a 100644
--- a/bin/varnishd/cache.h
+++ b/bin/varnishd/cache.h
@@ -804,7 +804,7 @@ ssize_t HTC_Read(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[];
-#include "http_headers.h"
+#include "tbl/http_headers.h"
 #undef HTTPH
 
 /* cache_main.c */
@@ -924,7 +924,7 @@ void VCL_Rel(struct VCL_conf **vcc);
 void VCL_Poll(void);
 
 #define VCL_MET_MAC(l,u,b) void VCL_##l##_method(struct sess *);
-#include "vcl_returns.h"
+#include "tbl/vcl_returns.h"
 #undef VCL_MET_MAC
 
 /* cache_vrt.c */
diff --git a/bin/varnishd/cache_ban.c b/bin/varnishd/cache_ban.c
index 97d961d..fe1efd0 100644
--- a/bin/varnishd/cache_ban.c
+++ b/bin/varnishd/cache_ban.c
@@ -127,7 +127,7 @@ static const struct pvar {
 	uint8_t			tag;
 } pvars[] = {
 #define PVAR(a, b, c)	{ (a), (b), (c) },
-#include "ban_vars.h"
+#include "tbl/ban_vars.h"
 #undef PVAR
 	{ 0, 0, 0}
 };
diff --git a/bin/varnishd/cache_http.c b/bin/varnishd/cache_http.c
index 25a6627..bd0380b 100644
--- a/bin/varnishd/cache_http.c
+++ b/bin/varnishd/cache_http.c
@@ -41,7 +41,7 @@
 #include "cache.h"
 
 #define HTTPH(a, b, c, d, e, f, g) char b[] = "*" a ":";
-#include "http_headers.h"
+#include "tbl/http_headers.h"
 #undef HTTPH
 
 /*lint -save -e773 not () */
@@ -91,7 +91,7 @@ static struct http_msg {
 	const char	*txt;
 } http_msg[] = {
 #define HTTP_RESP(n, t)	{ n, t},
-#include "http_response.h"
+#include "tbl/http_response.h"
 	{ 0, NULL }
 };
 
@@ -830,7 +830,7 @@ http_EstimateWS(const struct http *fm, unsigned how, uint16_t *nhd)
 #define HTTPH(a, b, c, d, e, f, g) \
 		if (((e) & how) && http_IsHdr(&fm->hd[u], (b))) \
 			continue;
-#include "http_headers.h"
+#include "tbl/http_headers.h"
 #undef HTTPH
 		l += PRNDUP(Tlen(fm->hd[u]) + 1);
 		(*nhd)++;
@@ -859,7 +859,7 @@ http_FilterFields(struct worker *w, unsigned vsl_id, struct http *to,
 #define HTTPH(a, b, c, d, e, f, g) \
 		if (((e) & how) && http_IsHdr(&fm->hd[u], (b))) \
 			continue;
-#include "http_headers.h"
+#include "tbl/http_headers.h"
 #undef HTTPH
 		http_copyheader(w, vsl_id, to, fm, u);
 	}
@@ -1111,6 +1111,6 @@ HTTP_Init(void)
 {
 
 #define HTTPH(a, b, c, d, e, f, g) b[0] = (char)strlen(b + 1);
-#include "http_headers.h"
+#include "tbl/http_headers.h"
 #undef HTTPH
 }
diff --git a/bin/varnishd/cache_vcl.c b/bin/varnishd/cache_vcl.c
index ac712fb..8848ddd 100644
--- a/bin/varnishd/cache_vcl.c
+++ b/bin/varnishd/cache_vcl.c
@@ -331,7 +331,7 @@ VCL_##func##_method(struct sess *sp)					\
 	assert(!((1U << sp->handling) & ~bitmap));			\
 }
 
-#include "vcl_returns.h"
+#include "tbl/vcl_returns.h"
 #undef VCL_MET_MAC
 
 /*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/stevedore.c b/bin/varnishd/stevedore.c
index c1e52cb..143e534 100644
--- a/bin/varnishd/stevedore.c
+++ b/bin/varnishd/stevedore.c
@@ -597,5 +597,5 @@ VRT_Stv_##nm(const char *nm)			\
 	return (stv->var_##nm(stv));		\
 }
 
-#include "vrt_stv_var.h"
+#include "tbl/vrt_stv_var.h"
 #undef VRTSTVVAR
diff --git a/bin/varnishd/stevedore.h b/bin/varnishd/stevedore.h
index 0ccf834..9cd0b7b 100644
--- a/bin/varnishd/stevedore.h
+++ b/bin/varnishd/stevedore.h
@@ -47,7 +47,7 @@ typedef void storage_close_f(const struct stevedore *);
 
 /* Prototypes for VCL variable responders */
 #define VRTSTVTYPE(ct) typedef ct storage_var_##ct(const struct stevedore *);
-#include "vrt_stv_var.h"
+#include "tbl/vrt_stv_var.h"
 #undef VRTSTVTYPE
 
 /*--------------------------------------------------------------------*/
@@ -77,7 +77,7 @@ struct stevedore {
 	struct lru		*lru;
 
 #define VRTSTVVAR(nm, vtype, ctype, dval) storage_var_##ctype *var_##nm;
-#include "vrt_stv_var.h"
+#include "tbl/vrt_stv_var.h"
 #undef VRTSTVVAR
 
 	/* private fields */
diff --git a/include/Makefile.am b/include/Makefile.am
index 3f2994c..de1b19a 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -11,7 +11,7 @@ pkginclude_HEADERS = \
 	vsm.h
 
 nobase_noinst_HEADERS = \
-	ban_vars.h \
+	tbl/ban_vars.h \
 	binary_heap.h \
 	cli_common.h \
 	cli_priv.h \
@@ -20,8 +20,8 @@ nobase_noinst_HEADERS = \
 	compat/execinfo.h \
 	compat/srandomdev.h \
 	flopen.h \
-	http_headers.h \
-	http_response.h \
+	tbl/http_headers.h \
+	tbl/http_response.h \
 	libvarnish.h \
 	libvcl.h \
 	miniobj.h \
@@ -98,7 +98,9 @@ vmod_abi.h: vcs_version.h
 	fi ; \
 	echo "#define VMOD_ABI_Version \"@PACKAGE_STRING@ $$GITID\"" > vmod_abi.h
 
-CLEANFILES = vcl_returns.h \
+CLEANFILES = \
+	tbl/vcl_returns.h \
+	tbl/vrt_stv_var.h \
 	vcl.h \
 	vrt_obj.h \
 	vmod_abi.h
diff --git a/include/ban_vars.h b/include/ban_vars.h
deleted file mode 100644
index 669b9b1..0000000
--- a/include/ban_vars.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*-
- * Copyright (c) 2008-2011 Varnish Software AS
- * All rights reserved.
- *
- * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Define which variables we can ban on, and which function does it.
- *
- */
-
-#define PVAR_HTTP	1
-#define PVAR_REQ	2
-
-PVAR("req.url",		PVAR_REQ,		BAN_ARG_URL)
-PVAR("req.http.",	PVAR_REQ|PVAR_HTTP,	BAN_ARG_REQHTTP)
-PVAR("obj.http.",	PVAR_HTTP,		BAN_ARG_OBJHTTP)
diff --git a/include/http_headers.h b/include/http_headers.h
deleted file mode 100644
index afb463c..0000000
--- a/include/http_headers.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*-
- * Copyright (c) 2006 Verdens Gang AS
- * Copyright (c) 2006-2010 Varnish Software AS
- * All rights reserved.
- *
- * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Argument list:
- * ---------------------------------------
- * 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
- *
- * see [RFC2616 13.5.1 End-to-end and Hop-by-hop Headers]
- *
- */
-
-/*lint -save -e525 -e539 */
-
-#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 */
-#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 */
-
-/*lint -restore */
diff --git a/include/http_response.h b/include/http_response.h
deleted file mode 100644
index f60820c..0000000
--- a/include/http_response.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * Copyright (c) 2006 Verdens Gang AS
- * Copyright (c) 2006-2009 Varnish Software AS
- * All rights reserved.
- *
- * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-HTTP_RESP(101, "Switching Protocols")
-HTTP_RESP(200, "OK")
-HTTP_RESP(201, "Created")
-HTTP_RESP(202, "Accepted")
-HTTP_RESP(203, "Non-Authoritative Information")
-HTTP_RESP(204, "No Content")
-HTTP_RESP(205, "Reset Content")
-HTTP_RESP(206, "Partial Content")
-HTTP_RESP(300, "Multiple Choices")
-HTTP_RESP(301, "Moved Permanently")
-HTTP_RESP(302, "Found")
-HTTP_RESP(303, "See Other")
-HTTP_RESP(304, "Not Modified")
-HTTP_RESP(305, "Use Proxy")
-HTTP_RESP(306, "(Unused)")
-HTTP_RESP(307, "Temporary Redirect")
-HTTP_RESP(400, "Bad Request")
-HTTP_RESP(401, "Unauthorized")
-HTTP_RESP(402, "Payment Required")
-HTTP_RESP(403, "Forbidden")
-HTTP_RESP(404, "Not Found")
-HTTP_RESP(405, "Method Not Allowed")
-HTTP_RESP(406, "Not Acceptable")
-HTTP_RESP(407, "Proxy Authentication Required")
-HTTP_RESP(408, "Request Timeout")
-HTTP_RESP(409, "Conflict")
-HTTP_RESP(410, "Gone")
-HTTP_RESP(411, "Length Required")
-HTTP_RESP(412, "Precondition Failed")
-HTTP_RESP(413, "Request Entity Too Large")
-HTTP_RESP(414, "Request-URI Too Long")
-HTTP_RESP(415, "Unsupported Media Type")
-HTTP_RESP(416, "Requested Range Not Satisfiable")
-HTTP_RESP(417, "Expectation Failed")
-HTTP_RESP(500, "Internal Server Error")
-HTTP_RESP(501, "Not Implemented")
-HTTP_RESP(502, "Bad Gateway")
-HTTP_RESP(503, "Service Unavailable")
-HTTP_RESP(504, "Gateway Timeout")
-HTTP_RESP(505, "HTTP Version Not Supported")
diff --git a/include/tbl/ban_vars.h b/include/tbl/ban_vars.h
new file mode 100644
index 0000000..669b9b1
--- /dev/null
+++ b/include/tbl/ban_vars.h
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 2008-2011 Varnish Software AS
+ * All rights reserved.
+ *
+ * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Define which variables we can ban on, and which function does it.
+ *
+ */
+
+#define PVAR_HTTP	1
+#define PVAR_REQ	2
+
+PVAR("req.url",		PVAR_REQ,		BAN_ARG_URL)
+PVAR("req.http.",	PVAR_REQ|PVAR_HTTP,	BAN_ARG_REQHTTP)
+PVAR("obj.http.",	PVAR_HTTP,		BAN_ARG_OBJHTTP)
diff --git a/include/tbl/http_headers.h b/include/tbl/http_headers.h
new file mode 100644
index 0000000..afb463c
--- /dev/null
+++ b/include/tbl/http_headers.h
@@ -0,0 +1,103 @@
+/*-
+ * Copyright (c) 2006 Verdens Gang AS
+ * Copyright (c) 2006-2010 Varnish Software AS
+ * All rights reserved.
+ *
+ * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Argument list:
+ * ---------------------------------------
+ * 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
+ *
+ * see [RFC2616 13.5.1 End-to-end and Hop-by-hop Headers]
+ *
+ */
+
+/*lint -save -e525 -e539 */
+
+#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 */
+#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 */
+
+/*lint -restore */
diff --git a/include/tbl/http_response.h b/include/tbl/http_response.h
new file mode 100644
index 0000000..f60820c
--- /dev/null
+++ b/include/tbl/http_response.h
@@ -0,0 +1,70 @@
+/*-
+ * Copyright (c) 2006 Verdens Gang AS
+ * Copyright (c) 2006-2009 Varnish Software AS
+ * All rights reserved.
+ *
+ * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+HTTP_RESP(101, "Switching Protocols")
+HTTP_RESP(200, "OK")
+HTTP_RESP(201, "Created")
+HTTP_RESP(202, "Accepted")
+HTTP_RESP(203, "Non-Authoritative Information")
+HTTP_RESP(204, "No Content")
+HTTP_RESP(205, "Reset Content")
+HTTP_RESP(206, "Partial Content")
+HTTP_RESP(300, "Multiple Choices")
+HTTP_RESP(301, "Moved Permanently")
+HTTP_RESP(302, "Found")
+HTTP_RESP(303, "See Other")
+HTTP_RESP(304, "Not Modified")
+HTTP_RESP(305, "Use Proxy")
+HTTP_RESP(306, "(Unused)")
+HTTP_RESP(307, "Temporary Redirect")
+HTTP_RESP(400, "Bad Request")
+HTTP_RESP(401, "Unauthorized")
+HTTP_RESP(402, "Payment Required")
+HTTP_RESP(403, "Forbidden")
+HTTP_RESP(404, "Not Found")
+HTTP_RESP(405, "Method Not Allowed")
+HTTP_RESP(406, "Not Acceptable")
+HTTP_RESP(407, "Proxy Authentication Required")
+HTTP_RESP(408, "Request Timeout")
+HTTP_RESP(409, "Conflict")
+HTTP_RESP(410, "Gone")
+HTTP_RESP(411, "Length Required")
+HTTP_RESP(412, "Precondition Failed")
+HTTP_RESP(413, "Request Entity Too Large")
+HTTP_RESP(414, "Request-URI Too Long")
+HTTP_RESP(415, "Unsupported Media Type")
+HTTP_RESP(416, "Requested Range Not Satisfiable")
+HTTP_RESP(417, "Expectation Failed")
+HTTP_RESP(500, "Internal Server Error")
+HTTP_RESP(501, "Not Implemented")
+HTTP_RESP(502, "Bad Gateway")
+HTTP_RESP(503, "Service Unavailable")
+HTTP_RESP(504, "Gateway Timeout")
+HTTP_RESP(505, "HTTP Version Not Supported")
diff --git a/lib/libvcl/generate.py b/lib/libvcl/generate.py
index 779091e..335cfd5 100755
--- a/lib/libvcl/generate.py
+++ b/lib/libvcl/generate.py
@@ -671,7 +671,7 @@ for i in returns:
 
 #######################################################################
 
-fo = open(buildroot + "/include/vcl_returns.h", "w")
+fo = open(buildroot + "/include/tbl/vcl_returns.h", "w")
 
 file_header(fo)
 
@@ -891,7 +891,7 @@ fo.close()
 
 #######################################################################
 
-fo = open(buildroot + "/include/vrt_stv_var.h", "w")
+fo = open(buildroot + "/include/tbl/vrt_stv_var.h", "w")
 
 file_header(fo)
 
diff --git a/lib/libvcl/vcc_action.c b/lib/libvcl/vcc_action.c
index 8c538ef..c11f5b2 100644
--- a/lib/libvcl/vcc_action.c
+++ b/lib/libvcl/vcc_action.c
@@ -269,7 +269,7 @@ parse_return(struct vcc *tl)
 			retval = 1;					\
 		}							\
 	} while (0);
-#include "vcl_returns.h"
+#include "tbl/vcl_returns.h"
 #undef VCL_RET_MAC
 	if (!retval) {
 		VSB_printf(tl->sb, "Expected return action name.\n");
@@ -330,7 +330,7 @@ static struct action_table {
 
 #define VCL_RET_MAC(l, U, B)						\
 	{ #l,			parse_new_syntax },
-#include "vcl_returns.h"
+#include "tbl/vcl_returns.h"
 #undef VCL_RET_MAC
 
 	/* Keep list sorted from here */
diff --git a/lib/libvcl/vcc_compile.c b/lib/libvcl/vcc_compile.c
index 36efa4b..a09f396 100644
--- a/lib/libvcl/vcc_compile.c
+++ b/lib/libvcl/vcc_compile.c
@@ -70,7 +70,7 @@
 
 struct method method_tab[] = {
 #define VCL_MET_MAC(l,U,m)	{ "vcl_"#l, m, VCL_MET_##U },
-#include "vcl_returns.h"
+#include "tbl/vcl_returns.h"
 #undef VCL_MET_MAC
 	{ NULL, 0U, 0}
 };
@@ -374,7 +374,7 @@ EmitStruct(const struct vcc *tl)
 	Fc(tl, 0, "\t.srcbody = srcbody,\n");
 #define VCL_MET_MAC(l,u,b) \
 	Fc(tl, 0, "\t." #l "_func = VGC_function_vcl_" #l ",\n");
-#include "vcl_returns.h"
+#include "tbl/vcl_returns.h"
 #undef VCL_MET_MAC
 	Fc(tl, 0, "};\n");
 }
@@ -722,7 +722,7 @@ VCC_Return_Name(unsigned method)
 
 	switch (method) {
 #define VCL_RET_MAC(l, U, B) case VCL_RET_##U: return(#l);
-#include "vcl_returns.h"
+#include "tbl/vcl_returns.h"
 #undef VCL_RET_MAC
 	default:
 		return (NULL);
diff --git a/lib/libvcl/vcc_storage.c b/lib/libvcl/vcc_storage.c
index 77c657c..5aff6e7 100644
--- a/lib/libvcl/vcc_storage.c
+++ b/lib/libvcl/vcc_storage.c
@@ -80,7 +80,7 @@ vcc_Stv_mkvar(struct vcc *tl, const struct token *t, enum var_type fmt)
 	v->name = TlDupTok(tl, t);
 	v->r_methods = 0
 #define VCL_MET_MAC(l,u,b)	| VCL_MET_##u
-#include "vcl_returns.h"
+#include "tbl/vcl_returns.h"
 #undef VCL_MET_MAC
 		;
 	v->fmt = fmt;
@@ -93,7 +93,7 @@ static struct stvars {
 	enum var_type	fmt;
 } stvars[] = {
 #define VRTSTVVAR(nm, vtype, ctype, dval)	{ #nm, vtype },
-#include "vrt_stv_var.h"
+#include "tbl/vrt_stv_var.h"
 #undef VRTSTVVAR
 	{ NULL,			BOOL }
 };
diff --git a/lib/libvcl/vcc_xref.c b/lib/libvcl/vcc_xref.c
index 560fe78..56a2747 100644
--- a/lib/libvcl/vcc_xref.c
+++ b/lib/libvcl/vcc_xref.c
@@ -226,7 +226,7 @@ vcc_CheckActionRecurse(struct vcc *tl, struct proc *p, unsigned bitmap)
 			VSB_printf(tl->sb, "Invalid return \"" #l "\"\n");\
 			vcc_ErrWhere(tl, p->return_tok[VCL_RET_##U]);	\
 		}
-#include "vcl_returns.h"
+#include "tbl/vcl_returns.h"
 #undef VCL_RET_MAC
 
 		VSB_printf(tl->sb, "\n...in subroutine \"%.*s\"\n",
@@ -271,7 +271,7 @@ vcc_checkaction1(struct vcc *tl, const struct symbol *sym)
 		if (m->ret_bitmap & ((1 << VCL_RET_##U)))	\
 			VSB_printf(tl->sb, " \"%s\"", #l);
 
-#include "vcl_returns.h"
+#include "tbl/vcl_returns.h"
 #undef VCL_RET_MAC
 		VSB_printf(tl->sb, "\n");
 		tl->err = 1;



More information about the varnish-commit mailing list