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.
Diff: HTTPClient.cpp
- Revision:
- 38:2ef07232f65c
- Parent:
- 37:74c1c4527f70
- Child:
- 41:37e7df011c1f
--- a/HTTPClient.cpp Sat Dec 17 15:19:55 2016 +0000 +++ b/HTTPClient.cpp Thu Dec 29 20:14:53 2016 +0000 @@ -67,6 +67,29 @@ m_location = NULL; // this step isn't necessary... } + +const char * HTTPClient::GetErrorMessage(HTTPResult res) +{ + const char * msg[HTTP_CLOSED+1] = { + "HTTP OK", ///<Success + "HTTP Processing", ///<Processing + "HTTP URL Parse error", ///<url Parse error + "HTTP DNS error", ///<Could not resolve name + "HTTP Protocol error", ///<Protocol error + "HTTP 404 Not Found", ///<HTTP 404 Error + "HTTP 403 Refused", ///<HTTP 403 Error + "HTTP ### Error", ///<HTTP xxx error + "HTTP Timeout", ///<Connection timeout + "HTTP Connection error", ///<Connection error + "HTTP Closed by remote host" ///<Connection was closed by remote host + }; + if (res <= HTTP_CLOSED) + return msg[res]; + else + return "HTTP Unknown Code"; +}; + + void HTTPClient::basicAuth(const char* user, const char* password) //Basic Authentification { #if 1