A HTTP/HTTPS Client for the mbed networking/CyaSSL ssl library
Dependents: Anpi dropbox_access php_access_auth TwitterReader ... more
Fork of HTTPClient by
HTTP and HTTPS Client Class with wolfSSL, embedded SSL library.
The class was forked from http://mbed.org/users/donatien/code/HTTPClient/
It, now, accepts url both with "http://" and "https://".
Allocate caller thread with 16kbytes or larger stack for "https" requests.
Rest of the API stays compatible with HTTPClient.
For more about the library, see http://www.wolfssl.com. http://wolfssl.com/yaSSL/Docs.html.
Extended methods:
- HTTPResult basicAuth(const char* user, const char* password); /* set id/passwd for basic Authentication */
- void setHeader(char *header) ; /* set http headers */
- HTTPResult setSSLversion(int minorV) ; /* set SSL/TLS version. 0: SSL3, 1: TLS1.0, 2: TLS1.1, 3: TLS1.2 */
Diff: HTTPClient.h
- Revision:
- 17:c73d8e61d391
- Parent:
- 16:1f743885e7de
- Child:
- 18:d89df40b4cf3
--- a/HTTPClient.h Thu Aug 30 15:38:57 2012 +0000 +++ b/HTTPClient.h Mon Apr 07 23:30:35 2014 +0000 @@ -24,8 +24,6 @@ #ifndef HTTP_CLIENT_H #define HTTP_CLIENT_H -#include "TCPSocketConnection.h" - #define HTTP_CLIENT_DEFAULT_TIMEOUT 15000 class HTTPData; @@ -125,6 +123,7 @@ @return The HTTP response code of the last request */ int getHTTPResponseCode(); + void setHeader(char *header) ; private: enum HTTP_METH @@ -139,10 +138,11 @@ HTTPResult connect(const char* url, HTTP_METH method, IHTTPDataOut* pDataOut, IHTTPDataIn* pDataIn, int timeout); //Execute request HTTPResult recv(char* buf, size_t minLen, size_t maxLen, size_t* pReadLen); //0 on success, err code on failure 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) ; + //Parameters - TCPSocketConnection m_sock; int m_timeout; @@ -150,6 +150,12 @@ const char* m_basicAuthPassword; int m_httpResponseCode; + char * header ; + /* for CyaSSL */ + int sockfd; + uint16_t port; + struct CYASSL_CTX* ctx ; + struct CYASSL * ssl ; }; //Including data containers here for more convenience