Page 1 of 1

Get length of full http response in case it is chunked

Posted: Mon Jan 23, 2023 7:22 am
by RichPiano
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.

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

Posted: Mon Jan 23, 2023 7:46 am
by boarchuz
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).

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

Posted: Mon Jan 23, 2023 11:05 am
by RichPiano