Skip to content

HTTPclient - add CHUNKED encoding support #1333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Dec 31, 2015

Conversation

Links2004
Copy link
Collaborator

@sticilface
Copy link
Contributor

Seems to have made things a bit unstable..
I get sometimes a wdt reset... and always on the final file a stack dump

[3] /configjava.js -> http://sticilface.github.io/espman/examples/ESPmanager-example/data/configjava.js
13.15KB downloaded
Download FAILED 13.15KB downloaded (4.00GB required)
[4] /ajax-loader.gif -> http://sticilface.github.io/espman/examples/ESPmanager-example/data/ajax-loader.gif
6.10KB downloaded
Download Successful
[5] /config.htm -> http://sticilface.github.io/espman/examples/ESPmanager-example/data/config.htm

Exception (9):
epc1=0x40100c16 epc2=0x00000000 epc3=0x00000000 excvaddr=0x2274696e depc=0x00000000

ctx: cont 
sp: 3fff2830 end: 3fff31d0 offset: 01a0

@sticilface
Copy link
Contributor

Still size -1 though. this will not fix that though correct? only the insertion of the length sent into the content

@Links2004
Copy link
Collaborator Author

(4.00GB required) sounds wrong to me.
if the server not report any size you only can check the written bytes count returned from
writeToStream function.
can you use objdump and show me the function / line here it hangs?

enabling DEBUG_HTTPCLIENT may also give more info.

len = (uint32_t) strtol((const char *) chunkHeader.c_str(), NULL, 16);
DEBUG_HTTPCLIENT("[HTTP-Client] read chunk len: %d\n", len);
if(len > 0) {
int r = writeToStreamDataBlock(stream, len);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this check if r != len to handle short writes? If there's a short write then it looks like this'll continue to iterate over the response.

@sticilface
Copy link
Contributor

the 4GB is because i was using size_t as value for http.getsize(), not realising that it can be negative. So -1 was obviously falling back to some really large number... not a biggy

add retry for short write
remove compiler warnings
@Links2004
Copy link
Collaborator Author

@gtalusan short write now have its own error (HTTPC_ERROR_STREAM_WRITE) no need to detect it in the application any more.
have add a retry too.

@gtalusan
Copy link
Contributor

Awesome!

Links2004 added a commit that referenced this pull request Dec 31, 2015
HTTPclient - add CHUNKED encoding support
@Links2004 Links2004 merged commit b640044 into esp8266:master Dec 31, 2015
@Pablo2048
Copy link

Pablo2048 commented Nov 9, 2018

This is HTTP client so when connecting to NOT ESP8266WebServer (so not always get Connection: close) there has to be chunking implemented...

@Spongman
Copy link

Spongman commented Nov 9, 2018

oh, sorry, my bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants