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 Vincent Wochnik

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:
32:7b9919d59194
Parent:
30:1df62fedb13b
Child:
35:d9e2d1c96b75
--- a/HTTPClient.h	Sat Jul 26 19:47:36 2014 +0000
+++ b/HTTPClient.h	Sat Oct 11 17:26:04 2014 +0000
@@ -63,8 +63,8 @@
     /**
     Provides a basic authentification feature (Base64 encoded username and password)
     Pass two NULL pointers to switch back to no authentication
-    @param user username to use for authentication, must remain valid durlng the whole HTTP session
-    @param user password to use for authentication, must remain valid durlng the whole HTTP session
+    @param[in] user username to use for authentication, must remain valid durlng the whole HTTP session
+    @param[in] user password to use for authentication, must remain valid durlng the whole HTTP session
     */
     void basicAuth(const char* user, const char* password); //Basic Authentification
 
@@ -87,17 +87,17 @@
         http.customHeaders(hdrs, 5);
     @endcode
     
-    @param headers an array (size multiple of two) key-value pairs, must remain valid during the whole HTTP session
-    @param pairs number of key-value pairs
+    @param[in] headers an array (size multiple of two) key-value pairs, must remain valid during the whole HTTP session
+    @param[in] pairs number of key-value pairs
     */
     void customHeaders(const char** headers, size_t pairs);
 
     //High Level setup functions
     /** Execute a GET request on the URL
     Blocks until completion
-    @param url : url on which to execute the request
-    @param pDataIn : pointer to an IHTTPDataIn instance that will collect the data returned by the request, can be NULL
-    @param timeout waiting timeout in ms (osWaitForever for blocking function, not recommended)
+    @param[in] url : url on which to execute the request
+    @param[in,out] pDataIn : pointer to an IHTTPDataIn instance that will collect the data returned by the request, can be NULL
+    @param[in] timeout waiting timeout in ms (osWaitForever for blocking function, not recommended)
     @return 0 on success, HTTP error (<0) on failure
     */
     HTTPResult get(const char* url, IHTTPDataIn* pDataIn, int timeout = HTTP_CLIENT_DEFAULT_TIMEOUT); //Blocking
@@ -105,39 +105,39 @@
     /** Execute a GET request on the URL
     Blocks until completion
     This is a helper to directly get a piece of text from a HTTP result
-    @param url : url on which to execute the request
-    @param result : pointer to a char array in which the result will be stored
-    @param maxResultLen : length of the char array (including space for the NULL-terminating char)
-    @param timeout waiting timeout in ms (osWaitForever for blocking function, not recommended)
+    @param[in] url : url on which to execute the request
+    @param[out] result : pointer to a char array in which the result will be stored
+    @param[in] maxResultLen : length of the char array (including space for the NULL-terminating char)
+    @param[in] timeout waiting timeout in ms (osWaitForever for blocking function, not recommended)
     @return 0 on success, HTTP error (<0) on failure
     */
     HTTPResult get(const char* url, char* result, size_t maxResultLen, int timeout = HTTP_CLIENT_DEFAULT_TIMEOUT); //Blocking
 
     /** Execute a POST request on the URL
     Blocks until completion
-    @param url : url on which to execute the request
-    @param dataOut : a IHTTPDataOut instance that contains the data that will be posted
-    @param pDataIn : pointer to an IHTTPDataIn instance that will collect the data returned by the request, can be NULL
-    @param timeout waiting timeout in ms (osWaitForever for blocking function, not recommended)
+    @param[in] url : url on which to execute the request
+    @param[out] dataOut : a IHTTPDataOut instance that contains the data that will be posted
+    @param[in,out] pDataIn : pointer to an IHTTPDataIn instance that will collect the data returned by the request, can be NULL
+    @param[in] timeout waiting timeout in ms (osWaitForever for blocking function, not recommended)
     @return 0 on success, HTTP error (<0) on failure
     */
     HTTPResult post(const char* url, const IHTTPDataOut& dataOut, IHTTPDataIn* pDataIn, int timeout = HTTP_CLIENT_DEFAULT_TIMEOUT); //Blocking
 
     /** Execute a PUT request on the URL
     Blocks until completion
-    @param url : url on which to execute the request
-    @param dataOut : a IHTTPDataOut instance that contains the data that will be put
-    @param pDataIn : pointer to an IHTTPDataIn instance that will collect the data returned by the request, can be NULL
-    @param timeout waiting timeout in ms (osWaitForever for blocking function, not recommended)
+    @param[in] url : url on which to execute the request
+    @param[in] dataOut : a IHTTPDataOut instance that contains the data that will be put
+    @param[in,out] pDataIn : pointer to an IHTTPDataIn instance that will collect the data returned by the request, can be NULL
+    @param[in] timeout waiting timeout in ms (osWaitForever for blocking function, not recommended)
     @return 0 on success, HTTP error (<0) on failure
     */
     HTTPResult put(const char* url, const IHTTPDataOut& dataOut, IHTTPDataIn* pDataIn, int timeout = HTTP_CLIENT_DEFAULT_TIMEOUT); //Blocking
 
     /** Execute a DELETE request on the URL
     Blocks until completion
-    @param url : url on which to execute the request
-    @param pDataIn : pointer to an IHTTPDataIn instance that will collect the data returned by the request, can be NULL
-    @param timeout waiting timeout in ms (osWaitForever for blocking function, not recommended)
+    @param[in] url : url on which to execute the request
+    @param[in,out] pDataIn : pointer to an IHTTPDataIn instance that will collect the data returned by the request, can be NULL
+    @param[in] timeout waiting timeout in ms (osWaitForever for blocking function, not recommended)
     @return 0 on success, HTTP error (<0) on failure
     */
     HTTPResult del(const char* url, IHTTPDataIn* pDataIn, int timeout = HTTP_CLIENT_DEFAULT_TIMEOUT); //Blocking
@@ -148,7 +148,7 @@
     int getHTTPResponseCode();
 
     /** Set the maximum number of automated redirections
-    @param i is the number of redirections. Values < 1 are
+    @param[in] i is the number of redirections. Values < 1 are
         set to 1.
     */
     void setMaxRedirections(int i = 1);