my fork
Fork of HTTPClient by
Diff: HTTPClient.cpp
- Revision:
- 13:be61104f4e91
- Parent:
- 12:89d09a6db00a
- Child:
- 14:2744e0c0e527
diff -r 89d09a6db00a -r be61104f4e91 HTTPClient.cpp --- a/HTTPClient.cpp Sun Aug 05 15:30:07 2012 +0000 +++ b/HTTPClient.cpp Sun Aug 05 16:12:10 2012 +0000 @@ -18,10 +18,11 @@ */ //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__); +//#define DBG(x, ...) std::printf("[HTTPClient : DBG]"x"\r\n", ##__VA_ARGS__); +#define DBG(x, ...) #define WARN(x, ...) std::printf("[HTTPClient : WARN]"x"\r\n", ##__VA_ARGS__); #define ERR(x, ...) std::printf("[HTTPClient : ERR]"x"\r\n", ##__VA_ARGS__); @@ -470,13 +471,13 @@ if(readLen < minLen) { DBG("Trying to read at most %d bytes [Blocking]", minLen - readLen); - m_sock.set_blocking(true, m_timeout); + m_sock.set_blocking(false, m_timeout); ret = m_sock.receive_all(buf + readLen, minLen - readLen); } else { DBG("Trying to read at most %d bytes [Not blocking]", maxLen - readLen); - m_sock.set_blocking(false); + m_sock.set_blocking(false, 0); ret = m_sock.receive(buf + readLen, maxLen - readLen); } @@ -527,7 +528,7 @@ return HTTP_CLOSED; //Connection was closed by server } - m_sock.set_blocking(true, m_timeout); + m_sock.set_blocking(false, m_timeout); int ret = m_sock.send_all(buf, len); if(ret > 0) {