Fixed HTTP header key and value length.

Dependents:   SNIC-httpclient-example HTTPClient_HelloWorld

Fork of HTTPClient by Donatien Garnier

Files at this revision

API Documentation at this revision

Comitter:
ban4jp
Date:
Sat Nov 22 08:54:27 2014 +0000
Parent:
19:b09072f8c133
Commit message:
Fixed: HTTP header value length. [34 => 64]; Fixed: HTTPResult values.

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	Sun Oct 12 16:00:13 2014 +0000
+++ b/HTTPClient.cpp	Sat Nov 22 08:54:27 2014 +0000
@@ -42,7 +42,7 @@
 
 #define CHUNK_SIZE 256
 #define HEADER_KEY_MAXLENGTH   34
-#define HEADER_VALUE_MAXLENGTH 34
+#define HEADER_VALUE_MAXLENGTH 64
 
 #include <cstring>
 
@@ -281,8 +281,8 @@
   while( true )
   {
     crlfPtr = strstr(buf, "\r\n");
-  if(crlfPtr == NULL)
-  {
+    if(crlfPtr == NULL)
+    {
       if( trfLen < CHUNK_SIZE - 1 )
       {
         size_t newTrfLen;
@@ -295,8 +295,8 @@
       }
       else
       {
-    PRTCL_ERR();
-  }
+        PRTCL_ERR();
+      }
     }
     break;
   }
@@ -313,7 +313,7 @@
   if( sscanf(buf, "HTTP/%*d.%*d %d", &m_httpResponseCode) != 1 ) //Kludge for newlib nano
   {
     //Cannot match string, error
-    ERR("Not a correct HTTP answer : %s\n", buf);
+    ERR("Not a correct HTTP answer : %s", buf);
     PRTCL_ERR();
   }
 
@@ -400,7 +400,7 @@
     }
     if ( n == 2 )
     {
-      DBG("Read header : %s: %s\n", key, value);
+      DBG("Read header : %s: %s", key, value);
       if( !strcmp(key, "Content-Length") )
       {
         sscanf(value, "%d", &recvContentLength);
--- a/HTTPClient.h	Sun Oct 12 16:00:13 2014 +0000
+++ b/HTTPClient.h	Sat Nov 22 08:54:27 2014 +0000
@@ -36,7 +36,7 @@
 ///HTTP client results
 enum HTTPResult
 {
-  HTTP_PROCESSING, ///<Processing
+  HTTP_PROCESSING = -10, ///<Processing
   HTTP_PARSE, ///<url Parse error
   HTTP_DNS, ///<Could not resolve name
   HTTP_PRTCL, ///<Protocol error