Commit acd718f0 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Only grab the first matched fragment in varnishncsa

Fixes: #1462
parent ed234cfd
...@@ -682,9 +682,12 @@ frag_fields(const char *b, const char *e, ...) ...@@ -682,9 +682,12 @@ frag_fields(const char *b, const char *e, ...)
q++; q++;
if (field == n) { if (field == n) {
if (frag->gen != CTX.gen) {
/* We only grab the same matching field once */
frag->gen = CTX.gen; frag->gen = CTX.gen;
frag->b = p; frag->b = p;
frag->e = q; frag->e = q;
}
field = va_arg(ap, int); field = va_arg(ap, int);
if (field == 0) if (field == 0)
break; break;
...@@ -698,6 +701,10 @@ static void ...@@ -698,6 +701,10 @@ static void
frag_line(const char *b, const char *e, struct fragment *f) frag_line(const char *b, const char *e, struct fragment *f)
{ {
if (f->gen == CTX.gen)
/* We only grab the same matching record once */
return;
/* Skip leading space */ /* Skip leading space */
while (b < e && isspace(*b)) while (b < e && isspace(*b))
++b; ++b;
......
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