Commit 2bead167 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Control the ESI parsing debug records with the esi_syntax bitmap parameter.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3431 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 9eb73df2
...@@ -158,8 +158,9 @@ esi_addbit(struct esi_work *ew) ...@@ -158,8 +158,9 @@ esi_addbit(struct esi_work *ew)
VTAILQ_INSERT_TAIL(&ew->sp->obj->esibits, ew->eb, list); VTAILQ_INSERT_TAIL(&ew->sp->obj->esibits, ew->eb, list);
ew->eb->verbatim = ew->dst; ew->eb->verbatim = ew->dst;
sprintf(ew->eb->chunk_length, "%x\r\n", Tlen(ew->dst)); sprintf(ew->eb->chunk_length, "%x\r\n", Tlen(ew->dst));
VSL(SLT_Debug, ew->sp->fd, "AddBit: %d <%.*s>", if (params->esi_syntax & 0x4)
Tlen(ew->dst), Tlen(ew->dst), ew->dst.b); VSL(SLT_Debug, ew->sp->fd, "AddBit: %d <%.*s>",
Tlen(ew->dst), Tlen(ew->dst), ew->dst.b);
return(ew->eb); return(ew->eb);
} }
...@@ -172,8 +173,9 @@ static void ...@@ -172,8 +173,9 @@ static void
esi_addverbatim(struct esi_work *ew) esi_addverbatim(struct esi_work *ew)
{ {
VSL(SLT_Debug, ew->sp->fd, "AddVer: %d <%.*s>", if (params->esi_syntax & 0x4)
Tlen(ew->o), Tlen(ew->o), ew->o.b); 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) if (ew->o.b != ew->dst.e)
memmove(ew->dst.e, ew->o.b, Tlen(ew->o)); memmove(ew->dst.e, ew->o.b, Tlen(ew->o));
ew->dst.e += Tlen(ew->o); ew->dst.e += Tlen(ew->o);
...@@ -283,9 +285,9 @@ esi_addinclude(struct esi_work *ew, txt t) ...@@ -283,9 +285,9 @@ esi_addinclude(struct esi_work *ew, txt t)
VSL(SLT_Debug, 0, "Incl \"%.*s\"", t.e - t.b, t.b); VSL(SLT_Debug, 0, "Incl \"%.*s\"", t.e - t.b, t.b);
eb = esi_addbit(ew); eb = esi_addbit(ew);
while (esi_attrib(ew, &t, &tag, &val) == 1) { while (esi_attrib(ew, &t, &tag, &val) == 1) {
VSL(SLT_Debug, 0, "<%.*s> -> <%.*s>", if (params->esi_syntax & 0x4)
tag.e - tag.b, tag.b, VSL(SLT_Debug, 0, "<%.*s> -> <%.*s>",
val.e - val.b, val.b); tag.e - tag.b, tag.b, val.e - val.b, val.b);
if (Tlen(tag) != 3 || memcmp(tag.b, "src", 3)) if (Tlen(tag) != 3 || memcmp(tag.b, "src", 3))
continue; continue;
if (Tlen(val) == 0) { if (Tlen(val) == 0) {
...@@ -496,8 +498,9 @@ esi_parse2(struct esi_work *ew) ...@@ -496,8 +498,9 @@ esi_parse2(struct esi_work *ew)
r = p + 1; r = p + 1;
} }
VSL(SLT_Debug, ew->sp->fd, "Element: clos=%d [%.*s]", if (params->esi_syntax & 0x4)
celem, q - r, r); VSL(SLT_Debug, ew->sp->fd, "Element: clos=%d [%.*s]",
celem, q - r, r);
if (r + 9 < q && !memcmp(r, "esi:remove", 10)) { if (r + 9 < q && !memcmp(r, "esi:remove", 10)) {
...@@ -612,8 +615,9 @@ esi_parse(struct esi_work *ew) ...@@ -612,8 +615,9 @@ esi_parse(struct esi_work *ew)
{ {
char *p; char *p;
VSL(SLT_Debug, ew->sp->fd, "Parse: %d <%.*s>", if (params->esi_syntax & 0x4)
Tlen(ew->t), Tlen(ew->t), ew->t.b); VSL(SLT_Debug, ew->sp->fd, "Parse: %d <%.*s>",
Tlen(ew->t), Tlen(ew->t), ew->t.b);
p = esi_parse2(ew); p = esi_parse2(ew);
assert(ew->o.b >= ew->t.b); assert(ew->o.b >= ew->t.b);
assert(ew->o.e <= ew->t.e); assert(ew->o.e <= ew->t.e);
......
...@@ -764,6 +764,7 @@ static const struct parspec parspec[] = { ...@@ -764,6 +764,7 @@ static const struct parspec parspec[] = {
"Bitmap controlling ESI parsing code:\n" "Bitmap controlling ESI parsing code:\n"
" 0x00000001 - Don't check if it looks like XML\n" " 0x00000001 - Don't check if it looks like XML\n"
" 0x00000002 - Ignore non-esi elements\n" " 0x00000002 - Ignore non-esi elements\n"
" 0x00000004 - Emit parsing debug records\n"
"Use 0x notation and do the bitor in your head :-)\n", "Use 0x notation and do the bitor in your head :-)\n",
0, 0,
"0", "bitmap" }, "0", "bitmap" },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment