[master] 73b829f Add vct_tchar() (ref: rfc7230#section-3.2.6)

Poul-Henning Kamp phk at FreeBSD.org
Mon Sep 29 14:36:00 CEST 2014


commit 73b829fb7a7b15e2d214810a1fdd9a30a7181890
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Sep 29 12:11:11 2014 +0000

    Add vct_tchar() (ref: rfc7230#section-3.2.6)

diff --git a/include/vct.h b/include/vct.h
index 3c41dd7..5e1af85 100644
--- a/include/vct.h
+++ b/include/vct.h
@@ -40,6 +40,7 @@
 #define VCT_HEX			(1<<6)
 #define VCT_XMLNAMESTART	(1<<7)
 #define VCT_XMLNAME		(1<<8)
+#define VCT_TCHAR		(1<<9)
 
 extern const uint16_t vct_typtab[256];
 
@@ -61,6 +62,7 @@ vct_is(int x, uint16_t y)
 #define vct_issepctl(x) vct_is(x, VCT_SEPARATOR | VCT_CTL)
 #define vct_isxmlnamestart(x) vct_is(x, VCT_XMLNAMESTART)
 #define vct_isxmlname(x) vct_is(x, VCT_XMLNAMESTART | VCT_XMLNAME)
+#define vct_istchar(x) vct_is(x, VCT_ALPHA | VCT_DIGIT | VCT_TCHAR)
 
 #define vct_iscrlf(p) (((p)[0] == '\r' && (p)[1] == '\n') || (p)[0] == '\n')
 
diff --git a/lib/libvarnish/vct.c b/lib/libvarnish/vct.c
index c82e972..3ba4046 100644
--- a/lib/libvarnish/vct.c
+++ b/lib/libvarnish/vct.c
@@ -73,12 +73,20 @@ const uint16_t vct_typtab[256] = {
 	[0x1e]	=	VCT_CTL,
 	[0x1f]	=	VCT_CTL,
 	[0x20]  =	VCT_SP | VCT_SEPARATOR,
+	[0x21]  =	VCT_TCHAR,
 	[0x22]  =	VCT_SEPARATOR,
+	[0x23]  =	VCT_TCHAR,
+	[0x24]  =	VCT_TCHAR,
+	[0x25]  =	VCT_TCHAR,
+	[0x26]  =	VCT_TCHAR,
+	[0x27]  =	VCT_TCHAR,
 	[0x28]  =	VCT_SEPARATOR,
 	[0x29]  =	VCT_SEPARATOR,
+	[0x2a]  =	VCT_TCHAR,
+	[0x2b]  =	VCT_TCHAR,
 	[0x2c]  =	VCT_SEPARATOR,
-	[0x2d]	=	VCT_XMLNAME,
-	[0x2e]	=	VCT_XMLNAME,
+	[0x2d]	=	VCT_XMLNAME | VCT_TCHAR,
+	[0x2e]	=	VCT_XMLNAME | VCT_TCHAR,
 	[0x2f]  =	VCT_SEPARATOR,
 	[0x30]	=	VCT_DIGIT | VCT_HEX | VCT_XMLNAME,
 	[0x31]	=	VCT_DIGIT | VCT_HEX | VCT_XMLNAME,
@@ -126,7 +134,9 @@ const uint16_t vct_typtab[256] = {
 	[0x5b]  =	VCT_SEPARATOR,
 	[0x5c]  =	VCT_SEPARATOR,
 	[0x5d]  =	VCT_SEPARATOR,
-	[0x5f]	=	VCT_XMLNAMESTART,
+	[0x5e]  =	VCT_TCHAR,
+	[0x5f]	=	VCT_XMLNAMESTART | VCT_TCHAR,
+	[0x60]	=	VCT_TCHAR,
 	[0x61]	=	VCT_LOALPHA | VCT_HEX | VCT_XMLNAMESTART,
 	[0x62]	=	VCT_LOALPHA | VCT_HEX | VCT_XMLNAMESTART,
 	[0x63]	=	VCT_LOALPHA | VCT_HEX | VCT_XMLNAMESTART,
@@ -154,7 +164,9 @@ const uint16_t vct_typtab[256] = {
 	[0x79]	=	VCT_LOALPHA | VCT_XMLNAMESTART,
 	[0x7a]	=	VCT_LOALPHA | VCT_XMLNAMESTART,
 	[0x7b]  =	VCT_SEPARATOR,
+	[0x7c]	=	VCT_TCHAR,
 	[0x7d]  =	VCT_SEPARATOR,
+	[0x7e]	=	VCT_TCHAR,
 	[0x7f]	=	VCT_CTL,
 	[0xb7]	=	VCT_XMLNAME,
 	[0xc0]	=	VCT_XMLNAMESTART,



More information about the varnish-commit mailing list