From: mike Date: Fri, 4 May 2012 18:33:15 +0000 (+0000) Subject: httpReconnect() did not reset the read/write buffers (STR #4065) X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a94fb9c1f984928a854aecac24a3b5d455df2c7f;p=thirdparty%2Fcups.git httpReconnect() did not reset the read/write buffers (STR #4065) git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10446 7a7537e8-13f0-0310-91df-b6672ffda945 --- diff --git a/CHANGES-1.5.txt b/CHANGES-1.5.txt index c8dcb991e4..0580958c40 100644 --- a/CHANGES-1.5.txt +++ b/CHANGES-1.5.txt @@ -3,6 +3,7 @@ CHANGES-1.5.txt CHANGES IN CUPS V1.5.3 + - httpReconnect() did not reset the read/write buffers (STR #4065) - Compiling without threading support failed (STR #4060) - Fixed compile problem with old versions of OpenSSL (STR #4036) - The network backends did not check SNMP supply levels regularly diff --git a/cups/http.c b/cups/http.c index 5bb21f575a..b1f6f59f95 100644 --- a/cups/http.c +++ b/cups/http.c @@ -2356,6 +2356,23 @@ httpReconnect2(http_t *http, /* I - Connection to server */ http->fd = -1; } + /* + * Reset all state (except fields, which may be reused)... + */ + + http->state = HTTP_WAITING; + http->status = HTTP_CONTINUE; + http->version = HTTP_1_1; + http->keep_alive = HTTP_KEEPALIVE_OFF; + memset(&http->_hostaddr, 0, sizeof(http->_hostaddr)); + http->data_encoding = HTTP_ENCODE_LENGTH; + http->_data_remaining = 0; + http->used = 0; + http->expect = 0; + http->data_remaining = 0; + http->hostaddr = NULL; + http->wused = 0; + /* * Connect to the server... */ @@ -2394,8 +2411,6 @@ httpReconnect2(http_t *http, /* I - Connection to server */ http->hostaddr = &(addr->addr); http->error = 0; - http->status = HTTP_CONTINUE; - http->state = HTTP_WAITING; #ifdef HAVE_SSL if (http->encryption == HTTP_ENCRYPT_ALWAYS)