Fork of the working HTTPClient adaptation using CyaSSL. This version adds a derivation of HTTPText called HTTPJson to emit JSON text properly. Additionally, the URL parser has defines that permit longer URLs to be utilized.

Dependencies:   mbedTLSLibrary

Dependents:   SalesforceInterface df-2014-heroku-thermostat-k64f SalesforceInterface

Fork of HTTPClient by wolf SSL

This is a fork of the working HTTPS/SSL library that contains two extensions:

- HTTPJson - a derivation of HTTPText for emitting JSON strings specifically. No JSON parsing/checking is accomplished - HTTPJson simply sets the right Content-Type for HTTP(S).

- Expanded internal buffers for longer URLs. This is set in HTTPClient.cpp and is tunable.

Revision:
26:bf979804b653
Parent:
22:4b9a4151cc73
Child:
29:2d96cc752d19
--- a/HTTPClient.h	Sat Jul 12 12:09:38 2014 +0000
+++ b/HTTPClient.h	Mon Jul 21 11:30:29 2014 +0000
@@ -43,6 +43,7 @@
     HTTP_TIMEOUT, ///<Connection timeout
     HTTP_CONN, ///<Connection error
     HTTP_CLOSED, ///<Connection was closed by remote host
+    HTTP_REDIRECT, ///<HTTP 300 - 303
     HTTP_OK = 0, ///<Success
 };
 
@@ -121,8 +122,9 @@
     */
     int getHTTPResponseCode();
     
-    void setHeader(char *header) ;   /* set http headers */
+    void setHeader(const char *header) ;   /* set http headers */
     HTTPResult setSSLversion(int minorV) ; /* set SSL/TLS version. 0: SSL3, 1: TLS1.0, 2: TLS1.1, 3: TLS1.2 */
+    void setLocationBuf(char *url, int size) ; /* set URL buffer for redirection */
 
 private:
     enum HTTP_METH {
@@ -140,6 +142,7 @@
     HTTPResult parseURL(const char* url, char* scheme, size_t maxSchemeLen, char* host, size_t maxHostLen, uint16_t* port, char* path, size_t maxPathLen); //Parse URL
     void cyassl_free(void) ;
     HTTPResult bAuth(void) ;
+    HTTPResult readHeader(void) ;
     
     //Parameters
 
@@ -149,8 +152,11 @@
     const char* m_basicAuthPassword;
     int m_httpResponseCode;
 
-    char * header ;
-
+    const char * header ;
+    char * redirect_url ;
+    int    redirect_url_size ;
+    int    redirect ;
+    
     /* for CyaSSL */
     int    SSLver ;
     uint16_t port;