Fork with custom headers and basic auth.

Dependents:   MbedSmartRest

Fork of HTTPClient by Kazushi Mukaiyama

Revision:
23:9386b15b0820
Parent:
22:967c00d70d95
--- a/HTTPClient.cpp	Sun Feb 02 16:40:08 2014 +0000
+++ b/HTTPClient.cpp	Wed Feb 05 16:21:39 2014 +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__); 
@@ -120,6 +120,7 @@
 
 HTTPResult HTTPClient::connect(const char* url, HTTP_METH method, IHTTPDataOut* pDataOut, IHTTPDataIn* pDataIn, int timeout) //Execute request
 { 
+puts("Connect called.");
   m_httpResponseCode = 0; //Invalidate code
   m_timeout = timeout;
   
@@ -517,7 +518,7 @@
     if(readLen < minLen)
     {
       DBG("Trying to read at most %d bytes [Blocking]", minLen - readLen);
-      m_sock.set_blocking(false, m_timeout);
+      m_sock.set_blocking(true, m_timeout);
       ret = m_sock.receive_all(buf + readLen, minLen - readLen);
     }
     else
@@ -574,7 +575,7 @@
     return HTTP_CLOSED; //Connection was closed by server 
   }
   
-  m_sock.set_blocking(false, m_timeout);
+  m_sock.set_blocking(true, m_timeout);
   int ret = m_sock.send_all(buf, len);
   if(ret > 0)
   {