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:
- 23:1a0d4d70f72c
- Parent:
- 21:6e5c122ad9e5
- Child:
- 24:dafc02922e40
diff -r ae30428dc030 -r 1a0d4d70f72c HTTPClient.cpp --- a/HTTPClient.cpp Thu Nov 17 14:08:30 2016 +0000 +++ b/HTTPClient.cpp Mon Dec 05 16:20:48 2016 +0000 @@ -18,7 +18,7 @@ */ //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__); @@ -126,7 +126,7 @@ char scheme[8]; uint16_t port; - char host[32]; + char host[64]; char path[64]; //First we need to parse the url (http[s]://host[:port][/[path]]) -- HTTPS not supported (yet?) HTTPResult res = parseURL(url, scheme, sizeof(scheme), host, sizeof(host), &port, path, sizeof(path)); @@ -165,7 +165,6 @@ ret = send(buf); if(ret) { - //m_sock.close(); m_sock.close(); ERR("Could not write request"); return HTTP_CONN; @@ -271,7 +270,6 @@ //Receive response DBG("Receiving response"); -printf ("Receiving response\n\r"); ret = recv(buf, 1, CHUNK_SIZE - 1, &trfLen); //Read n bytes CHECK_CONN_ERR(ret); @@ -303,7 +301,6 @@ } int crlfPos = crlfPtr - buf; buf[crlfPos] = '\0'; - //Parse HTTP response //if( sscanf(buf, "HTTP/%*d.%*d %d %*[^\r\n]", &m_httpResponseCode) != 1 ) if(crlfPos > 13)