Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of HTTPClient by
Diff: HTTPClient.cpp
- Revision:
- 24:dafc02922e40
- Parent:
- 23:1a0d4d70f72c
- Child:
- 25:0b028f51b4ce
diff -r 1a0d4d70f72c -r dafc02922e40 HTTPClient.cpp --- a/HTTPClient.cpp Mon Dec 05 16:20:48 2016 +0000 +++ b/HTTPClient.cpp Fri Jan 13 14:40:02 2017 +0000 @@ -18,7 +18,7 @@ */ //Debug is disabled by default -#if 1 +#if 0 //Enable debug #include <cstdio> #define DBG(x, ...) std::printf("[HTTPClient : DBG]"x"\r\n", ##__VA_ARGS__); @@ -47,7 +47,8 @@ #include <cstring> #include "HTTPClient.h" -HTTPClient::HTTPClient(NetworkStack & _m_intf) : m_intf(_m_intf) +//HTTPClient::HTTPClient(NetworkStack & _m_intf) : m_intf(_m_intf) +HTTPClient::HTTPClient(SpwfSAInterface & _m_intf) : m_intf(_m_intf) { } @@ -136,17 +137,22 @@ return res; } + if ((strcmp ("https", scheme)) == 0 || (strcmp ("HTTPS", scheme) == 0)) { + if ( port == 0) port = 443; + m_intf.set_secure_mode(); + } if(port == 0) //TODO do handle HTTPS->443 { port = 80; } - + DBG("Scheme: %s", scheme); DBG("Host: %s", host); DBG("Port: %d", port); DBG("Path: %s", path); // Open m_sock.open(&m_intf); + m_intf.set_unsecure_mode(); //Connect DBG("Connecting socket to server"); int ret = m_sock.connect(host, port);