Fixed custom headers and Basic authorization, added support for redirection, functional file download interface can be used for SW updates and more.
Dependents: Sample_HTTPClient Sample_HTTPClient LWM2M_NanoService_Ethernet LWM2M_NanoService_Ethernet ... more
Fork of HTTPClient by
More recent changes - added iCal processing.
Derivative of a derivative, however this one works when it comes to supplying Basic authorization to access a protected resource. Some additional changes to the debug interface to clean it up for consistency with many other components I have.
Revision 21:d33f7e1ce811, committed 2014-02-09
- Comitter:
- WiredHome
- Date:
- Sun Feb 09 22:25:28 2014 +0000
- Parent:
- 20:4ea5255c1b04
- Child:
- 22:d6b08d9749d6
- Commit message:
- Revise interface to Basic Auth credentials so it will cache them locally
Changed in this revision
HTTPClient.cpp | Show annotated file Show diff for this revision Revisions of this file |
HTTPClient.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/HTTPClient.cpp Sun Feb 02 16:47:06 2014 +0000 +++ b/HTTPClient.cpp Sun Feb 09 22:25:28 2014 +0000 @@ -58,8 +58,19 @@ void HTTPClient::basicAuth(const char* user, const char* password) //Basic Authentification { + #if 1 + if (m_basicAuthUser) + free(m_basicAuthUser); + m_basicAuthUser = (char *)malloc(strlen(user)+1); + strcpy(m_basicAuthUser, user); + if (m_basicAuthPassword) + free(m_basicAuthPassword); + m_basicAuthPassword = (char *)malloc(strlen(password)+1); + strcpy(m_basicAuthPassword, password); + #else m_basicAuthUser = user; m_basicAuthPassword = password; + #endif } void HTTPClient::customHeaders(const char **headers, size_t pairs)
--- a/HTTPClient.h Sun Feb 02 16:47:06 2014 +0000 +++ b/HTTPClient.h Sun Feb 09 22:25:28 2014 +0000 @@ -168,8 +168,8 @@ int m_timeout; - const char* m_basicAuthUser; - const char* m_basicAuthPassword; + char* m_basicAuthUser; + char* m_basicAuthPassword; const char** m_customHeaders; size_t m_nCustomHeaders; int m_httpResponseCode;