diff --git a/include/net/http_client.h b/include/net/http_client.h index d595dba0f72..504fe2b3b70 100644 --- a/include/net/http_client.h +++ b/include/net/http_client.h @@ -106,8 +106,8 @@ struct http_response { */ http_response_cb_t cb; - /** Where the body starts */ - uint8_t *body_start; + /** Start address of the body fragment contained in the recv_buf */ + uint8_t *body_frag_start; /** Where the response is stored, this is to be * provided by the user. diff --git a/subsys/mgmt/hawkbit/hawkbit.c b/subsys/mgmt/hawkbit/hawkbit.c index 47fd821d9ea..f3ab718be00 100644 --- a/subsys/mgmt/hawkbit/hawkbit.c +++ b/subsys/mgmt/hawkbit/hawkbit.c @@ -691,19 +691,19 @@ static void response_cb(struct http_response *rsp, switch (type) { case HAWKBIT_PROBE: if (hb_context.dl.http_content_size == 0) { - body_data = rsp->body_start; + body_data = rsp->body_frag_start; body_len = rsp->data_len; /* * subtract the size of the HTTP header from body_len */ - body_len -= (rsp->body_start - rsp->recv_buf); + body_len -= (rsp->body_frag_start - rsp->recv_buf); hb_context.dl.http_content_size = rsp->content_length; } else { /* * more general case where body data is set, but no need * to take the HTTP header into account */ - body_data = rsp->body_start; + body_data = rsp->body_frag_start; body_len = rsp->data_len; } @@ -765,19 +765,19 @@ static void response_cb(struct http_response *rsp, case HAWKBIT_PROBE_DEPLOYMENT_BASE: if (hb_context.dl.http_content_size == 0) { - body_data = rsp->body_start; + body_data = rsp->body_frag_start; body_len = rsp->data_len; /* * subtract the size of the HTTP header from body_len */ - body_len -= (rsp->body_start - rsp->recv_buf); + body_len -= (rsp->body_frag_start - rsp->recv_buf); hb_context.dl.http_content_size = rsp->content_length; } else { /* * more general case where body data is set, but no need * to take the HTTP header into account */ - body_data = rsp->body_start; + body_data = rsp->body_frag_start; body_len = rsp->data_len; } @@ -828,19 +828,19 @@ static void response_cb(struct http_response *rsp, case HAWKBIT_DOWNLOAD: if (hb_context.dl.http_content_size == 0) { - body_data = rsp->body_start; + body_data = rsp->body_frag_start; body_len = rsp->data_len; /* * subtract the size of the HTTP header from body_len */ - body_len -= (rsp->body_start - rsp->recv_buf); + body_len -= (rsp->body_frag_start - rsp->recv_buf); hb_context.dl.http_content_size = rsp->content_length; } else { /* * more general case where body data is set, but no need * to take the HTTP header into account */ - body_data = rsp->body_start; + body_data = rsp->body_frag_start; body_len = rsp->data_len; } diff --git a/subsys/net/lib/http/http_client.c b/subsys/net/lib/http/http_client.c index d02f2393169..d42a3badd88 100644 --- a/subsys/net/lib/http/http_client.c +++ b/subsys/net/lib/http/http_client.c @@ -264,9 +264,9 @@ static int on_body(struct http_parser *parser, const char *at, size_t length) req->internal.response.http_cb->on_body(parser, at, length); } - /* Reset the body_start pointer for each fragment. */ - if (!req->internal.response.body_start) { - req->internal.response.body_start = (uint8_t *)at; + /* Reset the body_frag_start pointer for each fragment. */ + if (!req->internal.response.body_frag_start) { + req->internal.response.body_frag_start = (uint8_t *)at; } return 0; @@ -406,7 +406,7 @@ static int http_wait_data(int sock, struct http_request *req) req->internal.response.processed = 0; req->internal.response.data_len = 0; req->internal.response.content_length = 0; - req->internal.response.body_start = NULL; + req->internal.response.body_frag_start = NULL; memset(req->internal.response.http_status, 0, HTTP_STATUS_STR_SIZE); @@ -463,7 +463,7 @@ static int http_wait_data(int sock, struct http_request *req) /* Re-use the result buffer and start to fill it again */ req->internal.response.data_len = 0; - req->internal.response.body_start = NULL; + req->internal.response.body_frag_start = NULL; } }