A HTTP Client for the mbed networking libraries with HTTPFile for use with latest networking stack
Fork of HTTPClient by
An extension of the HTTPClient that adds HTTPFile. Currently on get is support and only works when getting binary files.
HTTPFile data("/local/firm.bin"); HTTPResult r = client.get("https://217.140.101.20/media/uploads/ollie8/firm.bin", &data); if (r == HTTP_OK) { }
Diff: HTTPClient.cpp
- Revision:
- 2:75f5b83238af
- Parent:
- 1:b70c37cf73ca
- Child:
- 3:5aef7584de4b
--- a/HTTPClient.cpp Thu Apr 26 14:17:23 2012 +0000 +++ b/HTTPClient.cpp Thu Apr 26 14:19:25 2012 +0000 @@ -156,6 +156,9 @@ size_t recvContentLength = 0; bool recvChunked = false; + char buf[CHUNK_SIZE]; + size_t trfLen; + int crlfPos; //Send all headers @@ -188,9 +191,6 @@ ret = send("\r\n"); if(ret != OK) goto connerr; - char buf[CHUNK_SIZE]; - size_t trfLen; - //Send data (if POST) if( (method == HTTP_POST) && (pDataOut != NULL) ) { @@ -251,7 +251,7 @@ goto prtclerr; } - int crlfPos = crlfPtr - buf; + crlfPos = crlfPtr - buf; buf[crlfPos] = '\0'; //Parse HTTP response