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:
51:3bdf57f7fd60
Parent:
50:a18a06b000f3
--- a/HTTPClient.h	Tue Jun 09 16:26:02 2015 +0000
+++ b/HTTPClient.h	Thu Aug 20 18:55:41 2015 +0000
@@ -32,6 +32,11 @@
 #include "mbed.h"
 #include "TCPSocketConnection.h"
 
+#include "polarssl/ssl.h"
+#include "polarssl/net.h"
+#include "polarssl/entropy.h"
+#include "polarssl/ctr_drbg.h"
+
 ///HTTP client results
 enum HTTPResult {
     HTTP_PROCESSING, ///<Processing
@@ -59,8 +64,6 @@
     ///Instantiate the HTTP client
     HTTPClient();
     ~HTTPClient();
-    
-    
 
     /**
     Provides a OAUTH2 authentification feature 
@@ -150,18 +153,22 @@
     HTTPResult send(char* buf, size_t len = 0); //0 on success, err code on failure
     HTTPResult flush(void); //0 on success, err code on failure
     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 tokenAuth(void) ;
     HTTPResult readHeader(void) ;
     
+    // SSL internal methods...
+    void ssl_cleanup(void) ;
+    void ssl_setup(const unsigned char *tag);
+    short ssl_connect();
+    void set_ssl_version();
+    
     //Parameters
-
     int m_timeout;
     const char* m_basicAuthUser;
     const char* m_basicAuthPassword;
+    int m_httpResponseCode;
     const char* m_oauthToken;
-    int m_httpResponseCode;
 
     TCPSocketConnection m_sock;
     
@@ -170,11 +177,13 @@
     int    redirect_url_size ;
     int    redirect ;
     
-    /* for CyaSSL */
-    int    SSLver ;
-    uint16_t port;
-    struct CYASSL_CTX* ctx ;
-    struct CYASSL    * ssl ;
+    // mbedTLS Support
+    int                     SSLver;
+    uint16_t                port;
+    entropy_context         entropy;
+    ctr_drbg_context        ctr_drbg;
+    ssl_context             ssl;
+    bool                    ssl_connected;
 };
 
 //Including data containers here for more convenience