[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE_3_2_BRANCH: kdelibs/kioslave/http
From: Waldo Bastian <bastian () kde ! org>
Date: 2004-01-18 16:15:17
Message-ID: 20040118161517.E0E5E906D () office ! kde ! org
[Download RAW message or body]
CVS commit by waba:
Some servers send gzip-encoded content but close the connection instead
of sending a proper gzip termination header. Don't report an error when
that happens. (BR72196) ( http://forums.amdmb.com/ )
M +20 -4 http.cc 1.601.2.1
M +1 -0 http.h 1.158.2.1
--- kdelibs/kioslave/http/http.cc #1.601:1.601.2.1
@@ -3979,4 +3979,12 @@ void HTTPProtocol::slotData(const QByteA
}
+ if (m_iContentLeft != NO_SIZE)
+ {
+ if (m_iContentLeft >= _d.size())
+ m_iContentLeft -= _d.size();
+ else
+ m_iContentLeft = NO_SIZE;
+ }
+
QByteArray d = _d;
if ( !m_dataInternal )
@@ -4137,4 +4145,6 @@ bool HTTPProtocol::readBody( bool dataIn
m_iBytesLeft = NO_SIZE;
+ m_iContentLeft = m_iBytesLeft;
+
if (m_bChunked)
m_iBytesLeft = NO_SIZE;
@@ -4209,10 +4219,16 @@ bool HTTPProtocol::readBody( bool dataIn
// make sure that this wasn't an error, first
-// kdDebug(7113) << "(" << m_pid << ") readBody: bytesReceived: "
-// << bytesReceived << " m_iSize: " << m_iSize << " Chunked: "
-// << m_bChunked << " BytesLeft: "<<m_iBytesLeft<<endl;
-
+ // kdDebug(7113) << "(" << (int) m_pid << ") readBody: bytesReceived: "
+ // << (int) bytesReceived << " m_iSize: " << (int) m_iSize << " Chunked: "
+ // << (int) m_bChunked << " BytesLeft: "<< (int) m_iBytesLeft << endl;
if (bytesReceived == -1)
{
+ if (m_iContentLeft == 0)
+ {
+ // gzip'ed data sometimes reports a too long content-length.
+ // (The length of the unzipped data)
+ m_iBytesLeft = 0;
+ break;
+ }
// Oh well... log an error and bug out
kdDebug(7113) << "(" << m_pid << ") readBody: bytesReceived==-1 sz=" << (int)sz
--- kdelibs/kioslave/http/http.h #1.158:1.158.2.1
@@ -466,4 +466,5 @@ protected:
KIO::filesize_t m_iSize; // Expected size of message
KIO::filesize_t m_iBytesLeft; // # of bytes left to receive in this message.
+ KIO::filesize_t m_iContentLeft; // # of content bytes left
QByteArray m_bufReceive; // Receive buffer
bool m_dataInternal; // Data is for internal consumption
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic