HTTP/HTTPS Client Library for the X-NUCLEO-IDW01M1v2 wifi board.
Dependents: HTTPClient_HelloWorld_IDW01M1 wifigianluigi HTTPClient_HelloWorld_IDW01M1_Fabio_Ricezione
Fork of HTTPClient by
Diff: HTTPClient.cpp
- Revision:
- 24:dafc02922e40
- Parent:
- 23:1a0d4d70f72c
--- 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);