Fork HTTPClient and Modfiy code for mbed 6.0
Dependents: mbed-demo-http-get-json
Diff: HTTPClient.cpp
- Revision:
- 21:d33f7e1ce811
- Parent:
- 20:4ea5255c1b04
- Child:
- 22:d6b08d9749d6
--- 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)