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
Revision 20:bbbfaf4cc055, committed 2016-11-08
- Comitter:
- mapellil
- Date:
- Tue Nov 08 17:21:42 2016 +0000
- Parent:
- 19:17578cfdb57a
- Child:
- 21:6e5c122ad9e5
- Commit message:
- fixed wind msg
Changed in this revision
| HTTPClient.cpp | Show annotated file Show diff for this revision Revisions of this file |
| HTTPSocket.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/HTTPClient.cpp Mon Nov 07 17:08:02 2016 +0000
+++ b/HTTPClient.cpp Tue Nov 08 17:21:42 2016 +0000
@@ -174,7 +174,7 @@
}
//Send all headers
-
+
//Send default headers
DBG("Sending headers");
if( pDataOut != NULL )
@@ -197,7 +197,7 @@
ret = send(buf);
CHECK_CONN_ERR(ret);
}
-
+
//Send specific headers
while( pDataOut->getHeader(buf, sizeof(buf) - 3) ) //must have space left for CRLF + 0 terminating char
{
@@ -223,15 +223,16 @@
CHECK_CONN_ERR(ret);
size_t trfLen;
-
//Send data (if available)
if( pDataOut != NULL )
{
DBG("Sending data");
while(true)
{
+
size_t writtenLen = 0;
pDataOut->read(buf, CHUNK_SIZE, &trfLen);
+
if( pDataOut->getIsChunked() )
{
//Write chunk header
@@ -273,6 +274,7 @@
//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);
@@ -302,7 +304,6 @@
}
break;
}
-printf (" ---->> buf: %s\n\r",buf);
int crlfPos = crlfPtr - buf;
buf[crlfPos] = '\0';
@@ -618,7 +619,7 @@
{
readLen += ret;
}
- else if( ret == 0 )
+ else if( ret == 0 || ret == NSAPI_ERROR_WOULD_BLOCK)
{
break;
}
--- a/HTTPSocket.h Mon Nov 07 17:08:02 2016 +0000
+++ b/HTTPSocket.h Tue Nov 08 17:21:42 2016 +0000
@@ -20,7 +20,7 @@
//SocketAddress addr(&spwf, hostname);
// pc.printf("\r\nst.com resolved to: %s\r\n", addr.get_ip_address());
- printf ("TCP hostaname: %s, port: %d\n\r", hostname, port);
+// printf ("TCP hostaname: %s, port: %d\n\r", hostname, port);
err = mysock.connect(hostname, port);
// t.start();
return err;
