r5747 - trunk/varnish-cache/bin/varnishd

phk at varnish-cache.org phk at varnish-cache.org
Fri Jan 14 13:51:10 CET 2011


Author: phk
Date: 2011-01-14 13:51:07 +0100 (Fri, 14 Jan 2011)
New Revision: 5747

Modified:
   trunk/varnish-cache/bin/varnishd/cache_esi_parse.c
   trunk/varnish-cache/bin/varnishd/mgt_param.c
Log:
Use esi_syntax bit 0x8 to control input block-length fuzzing for debugging
purposes.



Modified: trunk/varnish-cache/bin/varnishd/cache_esi_parse.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_esi_parse.c	2011-01-14 12:06:32 UTC (rev 5746)
+++ trunk/varnish-cache/bin/varnishd/cache_esi_parse.c	2011-01-14 12:51:07 UTC (rev 5747)
@@ -890,19 +890,17 @@
 		if (vep->hack_p == NULL)
 			vep->hack_p = (const char *)st->ptr + st->len;
 		vep->ver_p = (const char *)st->ptr + st->len;
-#if 0
-		{
-		ssize_t d;
-		for (l = 0; l < w; l += d)  {
-			d = 1;
-			if (l + d >= w)
-				d = 1;
-			vep_parse(vep, (const char *)st->ptr + st->len + l, d);
-		}
-		}
-#else
-		vep_parse(vep, (const char *)st->ptr + st->len, w);
-#endif
+		if (params->esi_syntax & 0x8) {
+			ssize_t d;
+			for (l = 0; l < w; l += d)  {
+				d = (random() & 3) + 1;
+				if (l + d >= w)
+					d = 1;
+				vep_parse(vep,
+				    (const char *)st->ptr + st->len + l, d);
+			}
+		} else
+			vep_parse(vep, (const char *)st->ptr + st->len, w);
 		st->len += w;
 		sp->obj->len += w;
 		if (st->len == st->space) {

Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_param.c	2011-01-14 12:06:32 UTC (rev 5746)
+++ trunk/varnish-cache/bin/varnishd/mgt_param.c	2011-01-14 12:51:07 UTC (rev 5747)
@@ -643,6 +643,7 @@
 		"  0x00000001 - Don't check if it looks like XML\n"
 		"  0x00000002 - Ignore non-esi elements\n"
 		"  0x00000004 - Emit parsing debug records\n"
+		"  0x00000008 - Force-dplit parser input (debugging)\n"
 		"Use 0x notation and do the bitor in your head :-)\n",
 		0,
 		"0", "bitmap" },




More information about the varnish-commit mailing list