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.cpp
- Revision:
- 13:be61104f4e91
- Parent:
- 12:89d09a6db00a
- Child:
- 14:2744e0c0e527
--- a/HTTPClient.cpp Sun Aug 05 15:30:07 2012 +0000 +++ b/HTTPClient.cpp Sun Aug 05 16:12:10 2012 +0000 @@ -18,10 +18,11 @@ */ //Debug is disabled by default -#if 0 +#if 1 //Enable debug #include <cstdio> -#define DBG(x, ...) std::printf("[HTTPClient : DBG]"x"\r\n", ##__VA_ARGS__); +//#define DBG(x, ...) std::printf("[HTTPClient : DBG]"x"\r\n", ##__VA_ARGS__); +#define DBG(x, ...) #define WARN(x, ...) std::printf("[HTTPClient : WARN]"x"\r\n", ##__VA_ARGS__); #define ERR(x, ...) std::printf("[HTTPClient : ERR]"x"\r\n", ##__VA_ARGS__); @@ -470,13 +471,13 @@ if(readLen < minLen) { DBG("Trying to read at most %d bytes [Blocking]", minLen - readLen); - m_sock.set_blocking(true, m_timeout); + m_sock.set_blocking(false, m_timeout); ret = m_sock.receive_all(buf + readLen, minLen - readLen); } else { DBG("Trying to read at most %d bytes [Not blocking]", maxLen - readLen); - m_sock.set_blocking(false); + m_sock.set_blocking(false, 0); ret = m_sock.receive(buf + readLen, maxLen - readLen); } @@ -527,7 +528,7 @@ return HTTP_CLOSED; //Connection was closed by server } - m_sock.set_blocking(true, m_timeout); + m_sock.set_blocking(false, m_timeout); int ret = m_sock.send_all(buf, len); if(ret > 0) {