net: http: client: handle empty body for PUT/POST request response

In previous version of the HTTP API, commit 8ebaf29927 ("net: http:
dont timeout on HTTP requests w/o body") fixed handling of HTTP
responses without body content.

For the new API, let's add a specific fix for when PUT/POST requests
are responded to with just the status code.

Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
This commit is contained in:
Michael Scott 2018-02-27 15:24:04 -08:00 committed by Carles Cufí
commit a2dfaebafc

View file

@ -423,6 +423,13 @@ static int on_headers_complete(struct http_parser *parser)
return 1;
}
if ((ctx->http.req.method == HTTP_PUT ||
ctx->http.req.method == HTTP_POST)
&& ctx->http.rsp.content_length == 0) {
NET_DBG("No body expected");
return 1;
}
NET_DBG("Headers complete");
return 0;