Fork with custom headers and basic auth.
Fork of HTTPClient by
Revision 22:967c00d70d95, committed 2014-02-02
- Comitter:
- vwochnik
- Date:
- Sun Feb 02 16:40:08 2014 +0000
- Parent:
- 21:66f1c10a5e9a
- Child:
- 23:9386b15b0820
- Commit message:
- fix
Changed in this revision
HTTPClient.cpp | Show annotated file Show diff for this revision Revisions of this file |
HTTPClient.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/HTTPClient.cpp Thu Jan 30 11:47:09 2014 +0000 +++ b/HTTPClient.cpp Sun Feb 02 16:40:08 2014 +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__); @@ -40,7 +40,7 @@ #define MIN(x,y) (((x)<(y))?(x):(y)) #define MAX(x,y) (((x)>(y))?(x):(y)) -#define CHUNK_SIZE 256 +#define CHUNK_SIZE 128 #include <cstring> @@ -181,24 +181,14 @@ strcat(buf, "\r\n"); ret = send(buf); - if(ret) - { - m_sock.close(); - ERR("Could not write request"); - return HTTP_CONN; - } + CHECK_CONN_ERR(ret); } //Send all headers for (size_t nh = 0; nh < m_nCustomHeaders; ++nh) { snprintf(buf, sizeof(buf), "%s: %s\r\n", m_customHeaders[nh], m_customHeaders[nh+1]); ret = send(buf); - if(ret) - { - m_sock.close(); - ERR("Could not write request"); - return HTTP_CONN; - } + CHECK_CONN_ERR(ret); } //Send default headers @@ -212,7 +202,7 @@ } else { - snprintf(buf, sizeof(buf), "Content-Length: %d\r\n", pDataOut->getDataLen()); + snprintf(buf, sizeof(buf), "Content-Length: %lu\r\n", pDataOut->getDataLen()); ret = send(buf); CHECK_CONN_ERR(ret); }
--- a/HTTPClient.h Thu Jan 30 11:47:09 2014 +0000 +++ b/HTTPClient.h Sun Feb 02 16:40:08 2014 +0000 @@ -26,7 +26,7 @@ #include "TCPSocketConnection.h" -#define HTTP_CLIENT_DEFAULT_TIMEOUT 15000 +#define HTTP_CLIENT_DEFAULT_TIMEOUT 60000 class HTTPData;