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

Give chunked precedence over C-L per RFC7230

parent f6d71499
......@@ -472,15 +472,6 @@ http_swallow_body(struct http *hp, char * const *hh, int body)
hp->body = hp->rxbuf + hp->prxbuf;
ll = 0;
p = http_find_header(hh, "content-length");
if (p != NULL) {
l = strtoul(p, NULL, 10);
(void)http_rxchar(hp, l, 0);
vtc_dump(hp->vl, 4, "body", hp->body, l);
hp->bodyl = l;
sprintf(hp->bodylen, "%d", l);
return;
}
p = http_find_header(hh, "transfer-encoding");
if (p != NULL && !strcasecmp(p, "chunked")) {
while (http_rxchunk(hp) != 0)
......@@ -491,6 +482,15 @@ http_swallow_body(struct http *hp, char * const *hh, int body)
sprintf(hp->bodylen, "%d", ll);
return;
}
p = http_find_header(hh, "content-length");
if (p != NULL) {
l = strtoul(p, NULL, 10);
(void)http_rxchar(hp, l, 0);
vtc_dump(hp->vl, 4, "body", hp->body, l);
hp->bodyl = l;
sprintf(hp->bodylen, "%d", l);
return;
}
if (body) {
do {
i = http_rxchar(hp, 1, 1);
......
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