diff --git a/subsys/net/lib/http/http_client.c b/subsys/net/lib/http/http_client.c index 5b19b0b60c2..c3b3168be8d 100644 --- a/subsys/net/lib/http/http_client.c +++ b/subsys/net/lib/http/http_client.c @@ -292,7 +292,8 @@ static int on_body(struct http_parser *parser, const char *at, size_t length) NET_DBG("Processed %zd length %zd", ctx->rsp.processed, length); - if (!ctx->rsp.body_start) { + if ((u8_t *)at != (u8_t *)ctx->rsp.response_buf) { + /* This fragment contains the start of the body */ ctx->rsp.body_start = (u8_t *)at; } @@ -309,6 +310,7 @@ static int on_body(struct http_parser *parser, const char *at, size_t length) /* Re-use the result buffer and start to fill it again */ ctx->rsp.data_len = 0; + ctx->rsp.body_start = NULL; } return 0;