[master] a39ba3d Make the esi-parse torture logic part of the esi_parser code so it applies to all fetch methods.

Poul-Henning Kamp phk at project.varnish-software.com
Sat Jan 22 09:04:29 CET 2011


commit a39ba3d88902233040e6dd67f4ca0e81b6aed263
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Sat Jan 22 08:03:50 2011 +0000

    Make the esi-parse torture logic part of the esi_parser code
    so it applies to all fetch methods.

diff --git a/bin/varnishd/cache_esi_deliver.c b/bin/varnishd/cache_esi_deliver.c
index ffd37ea..c60f6da 100644
--- a/bin/varnishd/cache_esi_deliver.c
+++ b/bin/varnishd/cache_esi_deliver.c
@@ -259,4 +259,3 @@ ESI_Deliver(struct sess *sp)
 	}
 	(void)WRW_Flush(sp->wrk);
 }
-
diff --git a/bin/varnishd/cache_esi_fetch.c b/bin/varnishd/cache_esi_fetch.c
index 20287ef..38102bf 100644
--- a/bin/varnishd/cache_esi_fetch.c
+++ b/bin/varnishd/cache_esi_fetch.c
@@ -64,17 +64,7 @@ vfp_esi_bytes_uu(struct sess *sp, struct http_conn *htc, size_t bytes)
 		w = HTC_Read(htc, st->ptr + st->len, l);
 		if (w <= 0)
 			return (w);
-		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(sp,
-				    (const char *)st->ptr + st->len + l, d);
-			}
-		} else
-			VEP_parse(sp, (const char *)st->ptr + st->len, w);
+		VEP_parse(sp, (const char *)st->ptr + st->len, w);
 		st->len += w;
 		sp->obj->len += w;
 		bytes -= w;
diff --git a/bin/varnishd/cache_esi_parse.c b/bin/varnishd/cache_esi_parse.c
index 5e85eff..ed04ec1 100644
--- a/bin/varnishd/cache_esi_parse.c
+++ b/bin/varnishd/cache_esi_parse.c
@@ -539,8 +539,8 @@ vep_do_include(struct vep_state *vep, enum dowhat what)
  * NB: the state-machine.  Please maintain it along with the code.
  */
 
-void
-VEP_parse(const struct sess *sp, const char *p, size_t l)
+static void
+vep_parse_int(const struct sess *sp, const char *p, size_t l)
 {
 	struct vep_state *vep;
 	const char *e;
@@ -965,6 +965,21 @@ VEP_parse(const struct sess *sp, const char *p, size_t l)
 		vep_mark_pending(vep, p);
 }
 
+void
+VEP_parse(const struct sess *sp, const char *p, size_t w)
+{
+	ssize_t l, d;
+
+	if (params->esi_syntax & 0x8) {
+		for (l = 0; l < w; l += d)  {
+			d = (random() & 3) + 1;
+			if (l + d >= w)
+				d = 1;
+			vep_parse_int(sp, p + l, d);
+		}
+	} else
+		vep_parse_int(sp, p, w);
+}
 
 /*---------------------------------------------------------------------
  */



More information about the varnish-commit mailing list