[master] fe1f9b1 Retire the "esi_syntax" bitmap parameter, and turn the still remaining bits into "feature" and "debug" flags.

Poul-Henning Kamp phk at varnish-cache.org
Tue Sep 17 09:40:39 CEST 2013


commit fe1f9b11a0574bb569885c10fe28ebffaa8983a9
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Sep 17 07:40:10 2013 +0000

    Retire the "esi_syntax" bitmap parameter, and turn the still remaining
    bits into "feature" and "debug" flags.

diff --git a/bin/varnishd/cache/cache_esi_fetch.c b/bin/varnishd/cache/cache_esi_fetch.c
index e64d796..c3274b1 100644
--- a/bin/varnishd/cache/cache_esi_fetch.c
+++ b/bin/varnishd/cache/cache_esi_fetch.c
@@ -59,7 +59,7 @@ struct vef_priv {
 /*---------------------------------------------------------------------
  * Read some bytes.
  *
- * If the esi_syntax&8 bit is set, we read only a couple of bytes at
+ * If the DBG_ESI_CHOP is set, we read only a couple of bytes at
  * a time, in order to stress the parse/pending/callback code.
  */
 
@@ -70,7 +70,7 @@ vef_read(struct http_conn *htc, void *buf, ssize_t buflen, ssize_t bytes)
 
 	if (buflen < bytes)
 		bytes = buflen;
-	if (cache_param->esi_syntax & 0x8) {
+	if (DO_DEBUG(DBG_ESI_CHOP)) {
 		d = (random() & 3) + 1;
 		if (d < bytes)
 			bytes = d;
diff --git a/bin/varnishd/cache/cache_esi_parse.c b/bin/varnishd/cache/cache_esi_parse.c
index 68c96e6..e173b93 100644
--- a/bin/varnishd/cache/cache_esi_parse.c
+++ b/bin/varnishd/cache/cache_esi_parse.c
@@ -268,9 +268,6 @@ static void
 vep_emit_skip(const struct vep_state *vep, ssize_t l)
 {
 
-	if (cache_param->esi_syntax & 0x20) {
-		Debug("---> SKIP(%jd)\n", (intmax_t)l);
-	}
 	vep_emit_len(vep, l, VEC_S1, VEC_S2, VEC_S8);
 }
 
@@ -279,9 +276,6 @@ vep_emit_verbatim(const struct vep_state *vep, ssize_t l, ssize_t l_crc)
 {
 	uint8_t buf[4];
 
-	if (cache_param->esi_syntax & 0x20) {
-		Debug("---> VERBATIM(%jd)\n", (intmax_t)l);
-	}
 	vep_emit_len(vep, l, VEC_V1, VEC_V2, VEC_V8);
 	if (vep->dogzip) {
 		vep_emit_len(vep, l_crc, VEC_C1, VEC_C2, VEC_C8);
@@ -600,7 +594,7 @@ VEP_Parse(const struct busyobj *bo, const char *p, size_t l)
 		 */
 
 		if (vep->state == VEP_START) {
-			if (cache_param->esi_syntax & 0x1)
+			if (FEATURE(FEATURE_ESI_DISABLE_XML_CHECK))
 				vep->state = VEP_NEXTTAG;
 			else
 				vep->state = VEP_TESTXML;
@@ -633,7 +627,7 @@ VEP_Parse(const struct busyobj *bo, const char *p, size_t l)
 		 */
 
 		} else if (vep->state == VEP_NOTMYTAG) {
-			if (cache_param->esi_syntax & 0x2) {
+			if (FEATURE(FEATURE_ESI_IGNORE_OTHER_ELEMENTS)) {
 				p++;
 				vep->state = VEP_NEXTTAG;
 			} else {
diff --git a/bin/varnishd/mgt/mgt_param_tbl.c b/bin/varnishd/mgt/mgt_param_tbl.c
index d4fcb53..6a0fc7c 100644
--- a/bin/varnishd/mgt/mgt_param_tbl.c
+++ b/bin/varnishd/mgt/mgt_param_tbl.c
@@ -323,17 +323,6 @@ const struct parspec mgt_parspec[] = {
 		"Upper limit on how many times a backend fetch can retry.\n",
 		0,
 		"4", "retries" },
-	{ "esi_syntax",
-		tweak_uint, &mgt_param.esi_syntax, 0, UINT_MAX,
-		"Bitmap controlling ESI parsing code:\n"
-		"  0x00000001 - Don't check if it looks like XML\n"
-		"  0x00000002 - Ignore non-esi elements\n"
-		"  0x00000004 - Emit parsing debug records\n"
-		"  0x00000008 - Force-split parser input (debugging)\n"
-		"\n"
-		"Use 0x notation and do the bitor in your head :-)\n",
-		0,
-		"0", "bitmap" },
 	{ "max_esi_depth",
 		tweak_uint, &mgt_param.max_esi_depth, 0, UINT_MAX,
 		"Maximum depth of esi:include processing.\n",
diff --git a/bin/varnishtest/tests/e00001.vtc b/bin/varnishtest/tests/e00001.vtc
index e988fb5..42a0c24 100644
--- a/bin/varnishtest/tests/e00001.vtc
+++ b/bin/varnishtest/tests/e00001.vtc
@@ -17,7 +17,7 @@ varnish v1 -vcl+backend {
 	sub vcl_backend_response {
 		set beresp.do_esi = true;
 	}
-} -start -cliok "param.set esi_syntax 4"
+} -start 
 
 client c1 {
 	txreq 
diff --git a/bin/varnishtest/tests/e00008.vtc b/bin/varnishtest/tests/e00008.vtc
index 53545d6..e99dac9 100644
--- a/bin/varnishtest/tests/e00008.vtc
+++ b/bin/varnishtest/tests/e00008.vtc
@@ -61,7 +61,7 @@ varnish v1 -vcl+backend {
 	}
 } -start 
 
-varnish v1 -cliok "param.set esi_syntax 0x3e" 
+varnish v1 -cliok "param.set debug +esi_chop" 
 
 varnish v1 -cliok "param.set debug +syncvsl"
 
diff --git a/bin/varnishtest/tests/e00009.vtc b/bin/varnishtest/tests/e00009.vtc
index e2ef6b3..938c200 100644
--- a/bin/varnishtest/tests/e00009.vtc
+++ b/bin/varnishtest/tests/e00009.vtc
@@ -30,7 +30,7 @@ client c1 {
 	expect resp.bodylen == 57
 } -run
 
-varnish v1  -cli "param.set esi_syntax 1" 
+varnish v1  -cli "param.set feature +esi_disable_xml_check" 
 
 client c1 {
 	txreq -url bar
diff --git a/bin/varnishtest/tests/e00010.vtc b/bin/varnishtest/tests/e00010.vtc
index 513a99a..0fccc41 100644
--- a/bin/varnishtest/tests/e00010.vtc
+++ b/bin/varnishtest/tests/e00010.vtc
@@ -15,7 +15,7 @@ varnish v1 -vcl+backend {
 	sub vcl_backend_response {
 		set beresp.do_esi = true;
 	}
-} -start -cli "param.set esi_syntax 2"
+} -start -cli "param.set feature +esi_ignore_other_elements"
 
 client c1 {
 	txreq 
diff --git a/bin/varnishtest/tests/e00019.vtc b/bin/varnishtest/tests/e00019.vtc
index 6a4b402..374bb18 100644
--- a/bin/varnishtest/tests/e00019.vtc
+++ b/bin/varnishtest/tests/e00019.vtc
@@ -36,8 +36,7 @@ varnish v1 -vcl+backend {
 	}
 } -start 
 
-varnish v1 -cliok "param.set esi_syntax 8" 
-
+varnish v1 -cliok "param.set debug +esi_chop"
 varnish v1 -cliok "param.set debug +syncvsl"
 
 client c1 {
diff --git a/bin/varnishtest/tests/e00020.vtc b/bin/varnishtest/tests/e00020.vtc
index 55d6923..121c80e 100644
--- a/bin/varnishtest/tests/e00020.vtc
+++ b/bin/varnishtest/tests/e00020.vtc
@@ -20,7 +20,6 @@ varnish v1 -vcl+backend {
 	}
 } -start 
 
-varnish v1 -cliok "param.set esi_syntax 4"
 varnish v1 -cliok "param.set http_gzip_support true"
 
 client c1 {
diff --git a/bin/varnishtest/tests/e00021.vtc b/bin/varnishtest/tests/e00021.vtc
index 26acd2c..9a0ead2 100644
--- a/bin/varnishtest/tests/e00021.vtc
+++ b/bin/varnishtest/tests/e00021.vtc
@@ -23,7 +23,7 @@ varnish v1 -vcl+backend {
 	}
 } -start 
 
-varnish v1 -cliok "param.set esi_syntax 0xc"
+varnish v1 -cliok "param.set debug +esi_chop"
 varnish v1 -cliok "param.set http_gzip_support true"
 
 client c1 {
diff --git a/bin/varnishtest/tests/e00022.vtc b/bin/varnishtest/tests/e00022.vtc
index be980c5..bc5b259 100644
--- a/bin/varnishtest/tests/e00022.vtc
+++ b/bin/varnishtest/tests/e00022.vtc
@@ -23,7 +23,7 @@ varnish v1 -arg "-p thread_pool_stack=262144" -vcl+backend {
 	}
 } -start 
 
-varnish v1 -cliok "param.set esi_syntax 0xc"
+varnish v1 -cliok "param.set debug +esi_chop"
 varnish v1 -cliok "param.set http_gzip_support true"
 varnish v1 -cliok "param.set gzip_memlevel 1"
 
diff --git a/bin/varnishtest/tests/e00023.vtc b/bin/varnishtest/tests/e00023.vtc
index 2508c9c..893fdf9 100644
--- a/bin/varnishtest/tests/e00023.vtc
+++ b/bin/varnishtest/tests/e00023.vtc
@@ -42,7 +42,8 @@ varnish v1 -vcl+backend {
 } -start 
 
 varnish v1 -cliok "param.set http_gzip_support true"
-varnish v1 -cliok "param.set esi_syntax 0x3e" 
+varnish v1 -cliok "param.set debug +esi_chop" 
+varnish v1 -cliok "param.set feature +esi_disable_xml_check" 
 
 varnish v1 -cliok "param.set debug +syncvsl"
 
diff --git a/bin/varnishtest/tests/e00024.vtc b/bin/varnishtest/tests/e00024.vtc
index 98b40cd..2ae231e 100644
--- a/bin/varnishtest/tests/e00024.vtc
+++ b/bin/varnishtest/tests/e00024.vtc
@@ -68,7 +68,7 @@ varnish v1 -vcl+backend {
 } -start 
 
 varnish v1 -cliok "param.set http_gzip_support true"
-varnish v1 -cliok "param.set esi_syntax 0x3e" 
+varnish v1 -cliok "param.set debug +esi_chop" 
 varnish v1 -cliok "param.set debug +syncvsl"
 
 client c1 {
diff --git a/bin/varnishtest/tests/e00026.vtc b/bin/varnishtest/tests/e00026.vtc
index d4c3a39..22e04fc 100644
--- a/bin/varnishtest/tests/e00026.vtc
+++ b/bin/varnishtest/tests/e00026.vtc
@@ -35,7 +35,7 @@ varnish v1 -vcl+backend {
 	}
 } -start 
 
-varnish v1 -cliok "param.set esi_syntax 0x21" 
+varnish v1 -cliok "param.set feature +esi_disable_xml_check"
 
 varnish v1 -cliok "param.set debug +syncvsl"
 
diff --git a/bin/varnishtest/tests/r00433.vtc b/bin/varnishtest/tests/r00433.vtc
index 2ccbd3f..01462d4 100644
--- a/bin/varnishtest/tests/r00433.vtc
+++ b/bin/varnishtest/tests/r00433.vtc
@@ -36,7 +36,6 @@ varnish v1 -vcl+backend {
 	}
 } -start
 
-varnish v1 -cliok "param.set esi_syntax 4"
 varnish v1 -cliok "param.set debug +syncvsl"
 varnish v1 -cliok "debug.fragfetch 32"
 
diff --git a/bin/varnishtest/tests/r01092.vtc b/bin/varnishtest/tests/r01092.vtc
index 59aacf3..7248e49 100644
--- a/bin/varnishtest/tests/r01092.vtc
+++ b/bin/varnishtest/tests/r01092.vtc
@@ -22,7 +22,7 @@ varnish v1 -vcl+backend {
 	sub vcl_backend_response {
 		set beresp.do_esi = true;
 	}
-} -start -cliok "param.set esi_syntax 4"
+} -start 
 
 client c1 {
 	txreq
diff --git a/include/tbl/debug_bits.h b/include/tbl/debug_bits.h
index 72d298d..7c6a655 100644
--- a/include/tbl/debug_bits.h
+++ b/include/tbl/debug_bits.h
@@ -37,3 +37,4 @@ DEBUG_BIT(SYNCVSL,		syncvsl,	"\t","Make VSL synchronous")
 DEBUG_BIT(HASHEDGE,		hashedge,	"",  "Edge cases in Hash")
 DEBUG_BIT(VCLREL,		vclrel,		"\t","Rapid VCL release")
 DEBUG_BIT(LURKER,		lurker,		"\t","VSL Ban lurker")
+DEBUG_BIT(ESI_CHOP,		esi_chop,	"",  "Chop ESI fetch to bits")
diff --git a/include/tbl/feature_bits.h b/include/tbl/feature_bits.h
index e6970ad..3e4ecba 100644
--- a/include/tbl/feature_bits.h
+++ b/include/tbl/feature_bits.h
@@ -29,19 +29,27 @@
  *
  */
 
-FEATURE_BIT(SHORT_PANIC,	short_panic,	"",
+FEATURE_BIT(SHORT_PANIC,		short_panic, "",
     "Short panic message.",
     "Reduce level of detail for panic messages."
 )
-FEATURE_BIT(WAIT_SILO,		wait_silo,	"",
+FEATURE_BIT(WAIT_SILO,			wait_silo, "",
     "Wait for persistent silo.",
     "Wait for persistent silos to load completely before serving requests."
 )
-FEATURE_BIT(NO_COREDUMP,	no_coredump,	"",
+FEATURE_BIT(NO_COREDUMP,		no_coredump, "",
     "No coredumps.",
     "Don't attempt to coredump child process on panics."
 )
-FEATURE_BIT(ESI_IGNORE_HTTPS,	esi_ignore_https,	"",
+FEATURE_BIT(ESI_IGNORE_HTTPS,		esi_ignore_https, "",
     "Treat HTTPS as HTTP in ESI:includes",
     "Convert <esi:include src\"https://... to http://..."
 )
+FEATURE_BIT(ESI_DISABLE_XML_CHECK,	esi_disable_xml_check, "",
+    "Don't check of body looks like XML",
+    "Allow ESI processing on any kind of object"
+)
+FEATURE_BIT(ESI_IGNORE_OTHER_ELEMENTS,	esi_ignore_other_elements, "",
+    "Ignore non-esi XML-elements",
+    "Allows syntax errors in the XML"
+)



More information about the varnish-commit mailing list