Commit abe626af authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Martin Blix Grydeland

Fix a couple of bugs for the detached rx*body functions.

parent 496d27f0
...@@ -465,10 +465,10 @@ http_swallow_body(struct http *hp, char * const *hh, int body) ...@@ -465,10 +465,10 @@ http_swallow_body(struct http *hp, char * const *hh, int body)
char *p; char *p;
int i, l, ll; int i, l, ll;
hp->body = hp->rxbuf + hp->prxbuf;
ll = 0; ll = 0;
p = http_find_header(hh, "content-length"); p = http_find_header(hh, "content-length");
if (p != NULL) { if (p != NULL) {
hp->body = hp->rxbuf + hp->prxbuf;
l = strtoul(p, NULL, 10); l = strtoul(p, NULL, 10);
(void)http_rxchar(hp, l, 0); (void)http_rxchar(hp, l, 0);
vtc_dump(hp->vl, 4, "body", hp->body, l); vtc_dump(hp->vl, 4, "body", hp->body, l);
...@@ -487,7 +487,6 @@ http_swallow_body(struct http *hp, char * const *hh, int body) ...@@ -487,7 +487,6 @@ http_swallow_body(struct http *hp, char * const *hh, int body)
return; return;
} }
if (body) { if (body) {
hp->body = hp->rxbuf + hp->prxbuf;
do { do {
i = http_rxchar(hp, 1, 1); i = http_rxchar(hp, 1, 1);
ll += i; ll += i;
...@@ -557,7 +556,6 @@ cmd_http_rxresp(CMD_ARGS) ...@@ -557,7 +556,6 @@ cmd_http_rxresp(CMD_ARGS)
if (http_count_header(hp->resp, "Content-Length") > 1) if (http_count_header(hp->resp, "Content-Length") > 1)
vtc_log(hp->vl, 0, vtc_log(hp->vl, 0,
"Multiple Content-Length headers.\n"); "Multiple Content-Length headers.\n");
hp->body = hp->rxbuf + hp->prxbuf;
if (!has_obj) if (!has_obj)
return; return;
else if (!strcmp(hp->resp[1], "200")) else if (!strcmp(hp->resp[1], "200"))
...@@ -847,7 +845,6 @@ cmd_http_rxreq(CMD_ARGS) ...@@ -847,7 +845,6 @@ cmd_http_rxreq(CMD_ARGS)
if (http_count_header(hp->req, "Content-Length") > 1) if (http_count_header(hp->req, "Content-Length") > 1)
vtc_log(hp->vl, 0, vtc_log(hp->vl, 0,
"Multiple Content-Length headers.\n"); "Multiple Content-Length headers.\n");
hp->body = hp->rxbuf + hp->prxbuf;
http_swallow_body(hp, hp->req, 0); http_swallow_body(hp, hp->req, 0);
vtc_log(hp->vl, 4, "bodylen = %s", hp->bodylen); vtc_log(hp->vl, 4, "bodylen = %s", hp->bodylen);
} }
......
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