From 4557d183b905685387d55b19eaa8403af24abb9c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Fri, 21 Jan 2022 09:48:01 +0100 Subject: [PATCH] net: http_client: Set body_start pointer unconditionally Set `body_start` pointer regardless of the body position in the recv buffer. In result, the pointer shall indicate correctly position of the body for each fragment, it's also explicit now that if the pointer is not set for a fragment, there's no body in that particular fragment. Signed-off-by: Robert Lubos --- subsys/net/lib/http/http_client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/net/lib/http/http_client.c b/subsys/net/lib/http/http_client.c index a2b9fa26ff7..22e945f6799 100644 --- a/subsys/net/lib/http/http_client.c +++ b/subsys/net/lib/http/http_client.c @@ -264,8 +264,8 @@ static int on_body(struct http_parser *parser, const char *at, size_t length) req->internal.response.http_cb->on_body(parser, at, length); } - if (!req->internal.response.body_start && - (uint8_t *)at != (uint8_t *)req->internal.response.recv_buf) { + /* Reset the body_start pointer for each fragment. */ + if (!req->internal.response.body_start) { req->internal.response.body_start = (uint8_t *)at; }