Commit 4763365d authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Pass a txt instead of the raw storage into the esi_parser


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2274 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent eed63415
...@@ -71,7 +71,7 @@ VTAILQ_HEAD(esibithead, esi_bit); ...@@ -71,7 +71,7 @@ VTAILQ_HEAD(esibithead, esi_bit);
struct esi_work { struct esi_work {
struct sess *sp; struct sess *sp;
size_t off; size_t off;
struct storage *st; txt t;
txt dst; txt dst;
struct esi_bit *eb; struct esi_bit *eb;
struct esi_bit *ebl; /* list of */ struct esi_bit *ebl; /* list of */
...@@ -93,14 +93,13 @@ esi_error(const struct esi_work *ew, const char *p, int i, const char *err) ...@@ -93,14 +93,13 @@ esi_error(const struct esi_work *ew, const char *p, int i, const char *err)
txt t; txt t;
if (i == 0) if (i == 0)
i = p - ((char *)ew->st->ptr + ew->st->len); i = p - ew->t.b;
if (i > 20) { if (i > 20) {
i = 20; i = 20;
ellipsis = 1; ellipsis = 1;
} }
q = buf; q = buf;
q += sprintf(buf, "at %zd: %s \"", q += sprintf(buf, "at %zd: %s \"", ew->off + (p - ew->t.b), err);
ew->off + (p - (char*)ew->st->ptr), err);
while (i > 0) { while (i > 0) {
if (*p >= ' ' && *p <= '~') { if (*p >= ' ' && *p <= '~') {
*q++ = *p; *q++ = *p;
...@@ -347,8 +346,7 @@ esi_parse(struct esi_work *ew) ...@@ -347,8 +346,7 @@ esi_parse(struct esi_work *ew)
int celem; /* closing element */ int celem; /* closing element */
int i; int i;
t.b = (char *)ew->st->ptr; t = ew->t;
t.e = t.b + ew->st->len;
ew->dst.b = t.b; ew->dst.b = t.b;
ew->dst.e = t.b; ew->dst.e = t.b;
o.b = t.b; o.b = t.b;
...@@ -574,7 +572,8 @@ VRT_ESI(struct sess *sp) ...@@ -574,7 +572,8 @@ VRT_ESI(struct sess *sp)
ew->off = 1; ew->off = 1;
VTAILQ_FOREACH(st, &sp->obj->store, list) { VTAILQ_FOREACH(st, &sp->obj->store, list) {
ew->st = st; ew->t.b = (void *)st->ptr;
ew->t.e = ew->t.b + st->len;
i = esi_parse(ew); i = esi_parse(ew);
ew->off += st->len; ew->off += st->len;
if (i < st->len) { if (i < st->len) {
......
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