Commit a39ba3d8 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make the esi-parse torture logic part of the esi_parser code

so it applies to all fetch methods.
parent 2700f6cd
......@@ -259,4 +259,3 @@ ESI_Deliver(struct sess *sp)
}
(void)WRW_Flush(sp->wrk);
}
......@@ -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;
......
......@@ -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);
}
/*---------------------------------------------------------------------
*/
......
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