Sends 'application/json' as the content type for AerCloud compatibility
Dependents: AerCloud_C027_Sample
Fork of HTTPClient by
Revision 20:b4a15dc7a299, committed 2014-11-14
- Comitter:
- mchowla
- Date:
- Fri Nov 14 00:47:34 2014 +0000
- Parent:
- 19:c96ef4c9695c
- Commit message:
- Fix bug where the any header value longer than 31 bytes would cause return a protocol error; ; Revert changes of DBG statements to printf
Changed in this revision
HTTPClient.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/HTTPClient.cpp Mon Nov 10 22:42:11 2014 +0000 +++ b/HTTPClient.cpp Fri Nov 14 00:47:34 2014 +0000 @@ -172,7 +172,7 @@ //Send all headers //Send default headers -// printf("Sending headers...\n"); + DBG("Sending headers"); if( pDataOut != NULL ) { if( pDataOut->getIsChunked() ) @@ -218,7 +218,7 @@ } //Close headers -// printf("Headers sent...\n"); + DBG("Headers sent"); ret = send("\r\n"); CHECK_CONN_ERR(ret); @@ -227,7 +227,7 @@ //Send data (if available) if( pDataOut != NULL ) { -// printf("Sending data...\n"); + DBG("Sending data"); while(true) { size_t writtenLen = 0; @@ -396,6 +396,11 @@ { strcpy(value, valueStart); n++; + } else { + // Value is too long, truncate it + strncpy(value, valueStart, 31); + value[31] = '\0'; + n++; } } } @@ -640,7 +645,6 @@ len = strlen(buf); } DBG("Trying to write %d bytes", len); - //printf("Sending %d bytes: %s\n",len, buf); size_t writtenLen = 0; if(!m_sock.is_connected())