Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Car_Bon_car_module
Fork of HTTPClient by
Revision 22:f6a3fcf48751, committed 2014-03-14
- Comitter:
- ansond
- Date:
- Fri Mar 14 20:03:23 2014 +0000
- Parent:
- 21:d33f7e1ce811
- Child:
- 23:96a9385ceeb6
- Commit message:
- updates
Changed in this revision
| HTTPClient.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/HTTPClient.cpp Sun Feb 09 22:25:28 2014 +0000
+++ b/HTTPClient.cpp Fri Mar 14 20:03:23 2014 +0000
@@ -140,8 +140,8 @@
char scheme[8];
uint16_t port;
- char host[32];
- char path[64];
+ char host[48];
+ char path[96];
//First we need to parse the url (http[s]://host[:port][/[path]]) -- HTTPS not supported (yet?)
HTTPResult res = parseURL(url, scheme, sizeof(scheme), host, sizeof(host), &port, path, sizeof(path));
if(res != HTTP_OK) {
@@ -169,7 +169,7 @@
//Send request
DBG("Sending request");
- char buf[CHUNK_SIZE];
+ char buf[CHUNK_SIZE+1];
const char* meth = (method==HTTP_GET)?"GET":(method==HTTP_POST)?"POST":(method==HTTP_PUT)?"PUT":(method==HTTP_DELETE)?"DELETE":"";
snprintf(buf, sizeof(buf), "%s %s HTTP/1.1\r\nHost: %s:%d\r\nConnection: keep-alive\r\n", meth, path, host, port); //Write request
ret = send(buf);
@@ -336,13 +336,13 @@
buf[crlfPos] = '\0';
- char key[32];
- char value[32];
+ char key[40];
+ char value[40];
key[31] = '\0';
value[31] = '\0';
- int n = sscanf(buf, "%31[^:]: %31[^\r\n]", key, value);
+ int n = sscanf(buf, "%35[^:]: %35[^\r\n]", key, value);
if ( n == 2 ) {
DBG("Read header : %s: %s\n", key, value);
if( !strcmp(key, "Content-Length") ) {
