]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix reading of trailing blank line on chunks.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 20 Feb 2013 21:07:30 +0000 (21:07 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 20 Feb 2013 21:07:30 +0000 (21:07 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10876 7a7537e8-13f0-0310-91df-b6672ffda945

cups/http.c

index ac97243f1cc29452966164e8fec30b47467f6475..d6918e09c13be6c3be22a8fd7cb25cce69c97498 100644 (file)
@@ -2286,6 +2286,18 @@ httpRead2(http_t *http,                  /* I - Connection to server */
           http->data_remaining  -= bytes;
           http->stream.avail_in += bytes;
 
+         if (http->data_remaining <= 0 &&
+             http->data_encoding == HTTP_ENCODING_CHUNKED)
+         {
+          /*
+           * Read the trailing blank line now...
+           */
+
+           char        len[32];                /* Length string */
+
+           httpGets(len, sizeof(len), http);
+         }
+
           bytes = 0;
         }
         else
@@ -2299,7 +2311,20 @@ httpRead2(http_t *http,                  /* I - Connection to server */
   if (http->data_remaining == 0 && http->data_encoding == HTTP_ENCODING_CHUNKED)
   {
     if ((bytes = http_read_chunk(http, buffer, length)) > 0)
+    {
       http->data_remaining -= bytes;
+
+      if (http->data_remaining <= 0)
+      {
+       /*
+        * Read the trailing blank line now...
+        */
+
+        char   len[32];                /* Length string */
+
+        httpGets(len, sizeof(len), http);
+      }
+    }
   }
   else if (http->data_remaining <= 0)
   {
@@ -2318,7 +2343,21 @@ httpRead2(http_t *http,                  /* I - Connection to server */
       length = (size_t)http->data_remaining;
 
     if ((bytes = http_read_buffered(http, buffer, length)) > 0)
+    {
       http->data_remaining -= bytes;
+
+      if (http->data_remaining <= 0 &&
+          http->data_encoding == HTTP_ENCODING_CHUNKED)
+      {
+       /*
+        * Read the trailing blank line now...
+        */
+
+        char   len[32];                /* Length string */
+
+        httpGets(len, sizeof(len), http);
+      }
+    }
   }
 
   if (