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) { }
Revision 19:bc765a7fd8f2, committed 2015-07-26
- Comitter:
- ollie8
- Date:
- Sun Jul 26 09:02:21 2015 +0000
- Parent:
- 18:1448391bbc51
- Commit message:
- Fixed bug in file write method
Changed in this revision
HTTPClient.cpp | Show annotated file Show diff for this revision Revisions of this file |
data/HTTPFile.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/HTTPClient.cpp Tue Dec 31 11:06:57 2013 +0000 +++ b/HTTPClient.cpp Sun Jul 26 09:02:21 2015 +0000 @@ -18,7 +18,7 @@ */ //Debug is disabled by default -#if 0 +#if 1 //Enable debug #include <cstdio> #define DBG(x, ...) std::printf("[HTTPClient : DBG]"x"\r\n", ##__VA_ARGS__);
--- a/data/HTTPFile.cpp Tue Dec 31 11:06:57 2013 +0000 +++ b/data/HTTPFile.cpp Sun Jul 26 09:02:21 2015 +0000 @@ -18,7 +18,7 @@ int HTTPFile::write(const char* buf, size_t len) { if (file) { - len = fwrite(&buf, 1, len, file); + len = fwrite(buf, 1, len, file); if ((!m_chunked && (ftell(file) >= m_len)) || (m_chunked && !len)) { close(); }