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 ST Expansion SW Team

Revision:
20:bbbfaf4cc055
Parent:
19:17578cfdb57a
Child:
21:6e5c122ad9e5
--- 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;
     }