changed buffer size for long urls

Dependents:   weather HTTPClient_IFTTT_Maker_post_HelloWorld Thingspeak_over_ethernet Thingspeak_over_ethernet

Fork of HTTPClient by Donatien Garnier

Files at this revision

API Documentation at this revision

Comitter:
colinmeikle
Date:
Fri Mar 20 14:17:14 2015 +0000
Parent:
18:277279a1891e
Commit message:
Changed buffer size to handle larger urls

Changed in this revision

HTTPClient.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 277279a1891e -r a0d9edb403e5 HTTPClient.cpp
--- a/HTTPClient.cpp	Wed May 07 16:48:10 2014 +0000
+++ b/HTTPClient.cpp	Fri Mar 20 14:17:14 2015 +0000
@@ -41,6 +41,7 @@
 #define MAX(x,y) (((x)>(y))?(x):(y))
 
 #define CHUNK_SIZE 256
+#define BUF_SIZE 128
 
 #include <cstring>
 
@@ -364,14 +365,14 @@
 
     buf[crlfPos] = '\0';
 
-    char key[32];
-    char value[32];
+    char key[BUF_SIZE];
+    char value[BUF_SIZE];
 
     //key[31] = '\0';
     //value[31] = '\0';
 
-    memset(key, 0, 32);
-    memset(value, 0, 32);
+    memset(key, 0, BUF_SIZE);
+    memset(value, 0, BUF_SIZE);
 
     //int n = sscanf(buf, "%31[^:]: %31[^\r\n]", key, value);
     
@@ -381,14 +382,14 @@
     if(keyEnd != NULL)
     {
       *keyEnd = '\0';
-      if(strlen(buf) < 32)
+      if(strlen(buf) < BUF_SIZE)
       {
         strcpy(key, buf);
         n++;
         char* valueStart = keyEnd + 2;
         if( (valueStart - buf) < crlfPos )
         {
-          if(strlen(valueStart) < 32)
+          if(strlen(valueStart) < BUF_SIZE)
           { 
             strcpy(value, valueStart);
             n++;