From: mike Date: Wed, 20 Feb 2013 21:07:30 +0000 (+0000) Subject: Fix reading of trailing blank line on chunks. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6dd0e99e60072629b40ffbc77a623138c29a65ca;p=thirdparty%2Fcups.git Fix reading of trailing blank line on chunks. git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10876 7a7537e8-13f0-0310-91df-b6672ffda945 --- diff --git a/cups/http.c b/cups/http.c index ac97243f1c..d6918e09c1 100644 --- a/cups/http.c +++ b/cups/http.c @@ -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 (