HTTPClient fork Support for Plantus Headers authentification
Fork of HTTPClient by
Revision 19:9954a6e0ef05, committed 2017-03-27
- Comitter:
- Jonathan Santerre
- Date:
- Mon Mar 27 16:19:24 2017 -0400
- Parent:
- 18:277279a1891e
- Commit message:
- Adapt lib to work with plantus api
Changed in this revision
diff -r 277279a1891e -r 9954a6e0ef05 HTTPClient.cpp --- a/HTTPClient.cpp Wed May 07 16:48:10 2014 +0000 +++ b/HTTPClient.cpp Mon Mar 27 16:19:24 2017 -0400 @@ -46,8 +46,8 @@ #include "HTTPClient.h" -HTTPClient::HTTPClient() : -m_sock(), m_basicAuthUser(NULL), m_basicAuthPassword(NULL), m_httpResponseCode(0) +HTTPClient::HTTPClient(const char* identifier) : +m_sock(), m_basicAuthUser(NULL), m_basicAuthPassword(NULL), m_httpResponseCode(0), identifier(identifier) { } @@ -173,6 +173,12 @@ //Send default headers DBG("Sending headers"); + + DBG("X-Authorization: %s\r\n", identifier); + snprintf(buf, sizeof(buf), "X-Authorization: %s\r\n", identifier); + ret = send(buf); + CHECK_CONN_ERR(ret); + if( pDataOut != NULL ) { if( pDataOut->getIsChunked() )
diff -r 277279a1891e -r 9954a6e0ef05 HTTPClient.h --- a/HTTPClient.h Wed May 07 16:48:10 2014 +0000 +++ b/HTTPClient.h Mon Mar 27 16:19:24 2017 -0400 @@ -58,7 +58,7 @@ { public: ///Instantiate the HTTP client - HTTPClient(); + HTTPClient(const char*); ~HTTPClient(); #if 0 //TODO add header handlers @@ -149,6 +149,7 @@ const char* m_basicAuthUser; const char* m_basicAuthPassword; int m_httpResponseCode; + const char* identifier; };
diff -r 277279a1891e -r 9954a6e0ef05 data/HTTPText.cpp --- a/data/HTTPText.cpp Wed May 07 16:48:10 2014 +0000 +++ b/data/HTTPText.cpp Mon Mar 27 16:19:24 2017 -0400 @@ -55,7 +55,7 @@ /*virtual*/ int HTTPText::getDataType(char* type, size_t maxTypeLen) //Internet media type for Content-Type header { - strncpy(type, "text/plain", maxTypeLen-1); + strncpy(type, "application/json", maxTypeLen-1); type[maxTypeLen-1] = '\0'; return OK; }