commit 41aed45e4fc95610b85fd19f973c924d8d4d3af5
parent 8e93dbc396147dd2320d420ee893144b3c51b01f
Author: Joris Vink <joris@coders.se>
Date: Wed, 9 Apr 2014 09:21:22 +0200
Do not miscalculate end_headers.
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/http.c b/src/http.c
@@ -364,15 +364,17 @@ http_header_recv(struct netbuf *nb)
if (nb->b_len < 4)
return (KORE_RESULT_OK);
+ skip = 4;
end_headers = kore_mem_find(nb->buf, nb->s_off, "\r\n\r\n", 4);
if (end_headers == NULL) {
end_headers = kore_mem_find(nb->buf, nb->s_off, "\n\n", 2);
if (end_headers == NULL)
return (KORE_RESULT_OK);
+ skip = 2;
}
*end_headers = '\0';
- end_headers += 4;
+ end_headers += skip;
nb->flags |= NETBUF_FORCE_REMOVE;
len = end_headers - nb->buf;
hbuf = (char *)nb->buf;
@@ -389,6 +391,7 @@ http_header_recv(struct netbuf *nb)
return (KORE_RESULT_OK);
}
+ skip = 0;
host[0] = NULL;
for (i = 0; i < h; i++) {
if (strncasecmp(headers[i], "host",