Get length of full http response in case it is chunked

RichPiano
Posts: 123
Joined: Mon May 18, 2020 2:51 pm

Get length of full http response in case it is chunked

Postby RichPiano » Mon Jan 23, 2023 7:22 am

Is there a way to get the full response length in case I just get chunks using the esp http client?

From the implementation it seems that client->response->chunk_length is always equal to client->response->content_length? Am I mistaken?

Use: I want to preallocate a buffer of the exact size of the response.

boarchuz
Posts: 606
Joined: Tue Aug 21, 2018 5:28 am

Re: Get length of full http response in case it is chunked

Postby boarchuz » Mon Jan 23, 2023 7:46 am

Not before the response is complete.
Chunked encoding is used when the server doesn't know the total length of its response beforehand. If it knew, it wouldn't need to use chunked encoding (unless it was being a PITA by choice).

RichPiano
Posts: 123
Joined: Mon May 18, 2020 2:51 pm

Re: Get length of full http response in case it is chunked

Postby RichPiano » Mon Jan 23, 2023 11:05 am


Who is online

Users browsing this forum: Baidu [Spider], Majestic-12 [Bot] and 107 guests