esp_http_client, returning wrong length

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

Re: esp_http_client, returning wrong length

Postby boarchuz » Sat Jul 27, 2019 10:53 pm

Code: Select all

content_length = -1 But the content length is not -1, its 40
They're different things. esp_http_client_get_content_length is the value parsed from the Content-Length header. If the server doesn't provide this, as is the case with your link, it will return -1.

You should revisit the example because you simply cannot have esp_http_client_fetch_headers and esp_http_client_perform playing nice together. That will break it. (I think I was wrong about _read though in my previous comment; I've been using the ON_DATA event callback so I'm not sure.)

mikemoy
Posts: 469
Joined: Fri Jan 12, 2018 9:10 pm

Re: esp_http_client, returning wrong length

Postby mikemoy » Sat Jul 27, 2019 11:06 pm

ok, will do.
So the question remains that after calling esp_http_client_perform(), how do i extract the data it received?
I cant see that they expect us to add code inside the event_handler to do this. I would assume they made a simple call like
esp_http_client_read(), to do that.

Who is online

Users browsing this forum: No registered users and 18 guests