Commit 6da64a47 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Avoid some code duplication

Apply some adjustments to recent patches based off of review by Nils
Goroll at UPLEX (@nigoroll)
parent af13de03
...@@ -128,15 +128,16 @@ http1_dissect_hdrs(struct http *hp, char *p, struct http_conn *htc, ...@@ -128,15 +128,16 @@ http1_dissect_hdrs(struct http *hp, char *p, struct http_conn *htc,
r++; r++;
continue; continue;
} }
if (!vct_iscrlf(r, htc->rxbuf_e)) { i = vct_iscrlf(r, htc->rxbuf_e);
if (i == 0) {
VSLb(hp->vsl, SLT_BogoHeader, VSLb(hp->vsl, SLT_BogoHeader,
"Header has ctrl char 0x%02x", *r); "Header has ctrl char 0x%02x", *r);
return (400); return (400);
} }
q = r; q = r;
assert(r < htc->rxbuf_e); r += i;
r = vct_skipcrlf(r, htc->rxbuf_e); assert(r <= htc->rxbuf_e);
if (r >= htc->rxbuf_e) if (r == htc->rxbuf_e)
break; break;
if (vct_iscrlf(r, htc->rxbuf_e)) if (vct_iscrlf(r, htc->rxbuf_e))
break; break;
......
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