better
Fork of HTTPClient by
Revision 20:b3dec7d44375, committed 2016-01-15
- Comitter:
- sifo
- Date:
- Fri Jan 15 09:12:01 2016 +0000
- Parent:
- 19:4609f454f8a3
- Commit message:
- klart
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 Fri Jan 15 04:24:14 2016 +0000 +++ b/HTTPClient.cpp Fri Jan 15 09:12:01 2016 +0000 @@ -57,13 +57,13 @@ } -#if 1 + void HTTPClient::basicAuth(const char* user, const char* password) //Basic Authentification { m_basicAuthUser = user; m_basicAuthPassword = password; } -#endif + HTTPResult HTTPClient::get(const char* url, IHTTPDataIn* pDataIn, int timeout /*= HTTP_CLIENT_DEFAULT_TIMEOUT*/) //Blocking { @@ -127,7 +127,7 @@ char scheme[8]; uint16_t port; char host[32]; - char path[64]; + char path[512]; //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) @@ -364,14 +364,14 @@ buf[crlfPos] = '\0'; - char key[32]; - char value[32]; + char key[128]; + char value[128]; //key[31] = '\0'; //value[31] = '\0'; - memset(key, 0, 32); - memset(value, 0, 32); + memset(key, 0, 128); + memset(value, 0, 128); //int n = sscanf(buf, "%31[^:]: %31[^\r\n]", key, value); @@ -381,7 +381,7 @@ if(keyEnd != NULL) { *keyEnd = '\0'; - if(strlen(buf) < 32) + if(strlen(buf) < 128) { strcpy(key, buf); n++;
--- a/HTTPClient.h Fri Jan 15 04:24:14 2016 +0000 +++ b/HTTPClient.h Fri Jan 15 09:12:01 2016 +0000 @@ -61,7 +61,7 @@ HTTPClient(); ~HTTPClient(); -#if 1 //TODO add header handlers + //TODO add header handlers /** Provides a basic authentification feature (Base64 encoded username and password) Pass two NULL pointers to switch back to no authentication @@ -69,7 +69,7 @@ @param user password to use for authentication, must remain valid durlng the whole HTTP session */ void basicAuth(const char* user, const char* password); //Basic Authentification -#endif + //High Level setup functions /** Execute a GET request on the URL