From 77c256a7b2bdef0d8107e95a1f43dd429e2d3c40 Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 24 Nov 2008 19:44:36 +0000 Subject: [PATCH] Control the ESI parsing debug records with the esi_syntax bitmap parameter. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3431 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_vrt_esi.c | 26 +++++++++++++--------- varnish-cache/bin/varnishd/mgt_param.c | 1 + 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_vrt_esi.c b/varnish-cache/bin/varnishd/cache_vrt_esi.c index 7145b7d2..69977863 100644 --- a/varnish-cache/bin/varnishd/cache_vrt_esi.c +++ b/varnish-cache/bin/varnishd/cache_vrt_esi.c @@ -158,8 +158,9 @@ esi_addbit(struct esi_work *ew) VTAILQ_INSERT_TAIL(&ew->sp->obj->esibits, ew->eb, list); ew->eb->verbatim = ew->dst; sprintf(ew->eb->chunk_length, "%x\r\n", Tlen(ew->dst)); - VSL(SLT_Debug, ew->sp->fd, "AddBit: %d <%.*s>", - Tlen(ew->dst), Tlen(ew->dst), ew->dst.b); + if (params->esi_syntax & 0x4) + VSL(SLT_Debug, ew->sp->fd, "AddBit: %d <%.*s>", + Tlen(ew->dst), Tlen(ew->dst), ew->dst.b); return(ew->eb); } @@ -172,8 +173,9 @@ static void esi_addverbatim(struct esi_work *ew) { - VSL(SLT_Debug, ew->sp->fd, "AddVer: %d <%.*s>", - Tlen(ew->o), Tlen(ew->o), ew->o.b); + if (params->esi_syntax & 0x4) + VSL(SLT_Debug, ew->sp->fd, "AddVer: %d <%.*s>", + Tlen(ew->o), Tlen(ew->o), ew->o.b); if (ew->o.b != ew->dst.e) memmove(ew->dst.e, ew->o.b, Tlen(ew->o)); ew->dst.e += Tlen(ew->o); @@ -283,9 +285,9 @@ esi_addinclude(struct esi_work *ew, txt t) VSL(SLT_Debug, 0, "Incl \"%.*s\"", t.e - t.b, t.b); eb = esi_addbit(ew); while (esi_attrib(ew, &t, &tag, &val) == 1) { - VSL(SLT_Debug, 0, "<%.*s> -> <%.*s>", - tag.e - tag.b, tag.b, - val.e - val.b, val.b); + if (params->esi_syntax & 0x4) + VSL(SLT_Debug, 0, "<%.*s> -> <%.*s>", + tag.e - tag.b, tag.b, val.e - val.b, val.b); if (Tlen(tag) != 3 || memcmp(tag.b, "src", 3)) continue; if (Tlen(val) == 0) { @@ -496,8 +498,9 @@ esi_parse2(struct esi_work *ew) r = p + 1; } - VSL(SLT_Debug, ew->sp->fd, "Element: clos=%d [%.*s]", - celem, q - r, r); + if (params->esi_syntax & 0x4) + VSL(SLT_Debug, ew->sp->fd, "Element: clos=%d [%.*s]", + celem, q - r, r); if (r + 9 < q && !memcmp(r, "esi:remove", 10)) { @@ -612,8 +615,9 @@ esi_parse(struct esi_work *ew) { char *p; - VSL(SLT_Debug, ew->sp->fd, "Parse: %d <%.*s>", - Tlen(ew->t), Tlen(ew->t), ew->t.b); + if (params->esi_syntax & 0x4) + VSL(SLT_Debug, ew->sp->fd, "Parse: %d <%.*s>", + Tlen(ew->t), Tlen(ew->t), ew->t.b); p = esi_parse2(ew); assert(ew->o.b >= ew->t.b); assert(ew->o.e <= ew->t.e); diff --git a/varnish-cache/bin/varnishd/mgt_param.c b/varnish-cache/bin/varnishd/mgt_param.c index 060d305c..1d307248 100644 --- a/varnish-cache/bin/varnishd/mgt_param.c +++ b/varnish-cache/bin/varnishd/mgt_param.c @@ -764,6 +764,7 @@ static const struct parspec parspec[] = { "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" "Use 0x notation and do the bitor in your head :-)\n", 0, "0", "bitmap" }, -- 2.39.5