Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
- index 17bd9c0..d93abb1 100644
- --- a/src/network/access/qhttpnetworkreply.cpp
- +++ b/src/network/access/qhttpnetworkreply.cpp
- @@ -257,7 +257,7 @@ QHttpNetworkReplyPrivate::QHttpNetworkReplyPrivate(const QUrl &newUrl)
- chunkedTransferEncoding(false),
- connectionCloseEnabled(true),
- forceConnectionCloseEnabled(false),
- - currentChunkSize(0), currentChunkRead(0), connection(0),
- + currentChunkSize(0), currentChunkRead(0), lastChunkRead(false), connection(0),
- autoDecompress(false), responseData(), requestIsPrepared(false)
- ,pipeliningUsed(false), downstreamLimited(false)
- ,userProvidedDownloadBuffer(0)
- @@ -277,6 +277,7 @@ void QHttpNetworkReplyPrivate::clearHttpLayerInformation()
- totalProgress = 0;
- currentChunkSize = 0;
- currentChunkRead = 0;
- + lastChunkRead = false;
- connectionCloseEnabled = true;
- #ifndef QT_NO_COMPRESS
- if (autoDecompress)
- @@ -721,7 +722,7 @@ qint64 QHttpNetworkReplyPrivate::readReplyBodyChunked(QAbstractSocket *socket, Q
- {
- qint64 bytes = 0;
- while (socket->bytesAvailable()) {
- - if (currentChunkRead >= currentChunkSize) {
- + if (!lastChunkRead && currentChunkRead >= currentChunkSize) {
- // For the first chunk and when we're done with a chunk
- currentChunkSize = 0;
- currentChunkRead = 0;
- @@ -744,13 +745,16 @@ qint64 QHttpNetworkReplyPrivate::readReplyBodyChunked(QAbstractSocket *socket, Q
- break;
- }
- // if the chunk size is 0, end of the stream
- - if (currentChunkSize == 0) {
- + if (currentChunkSize == 0 || lastChunkRead) {
- + lastChunkRead = true;
- // try to read the "\r\n" after the chunk
- char crlf[2];
- qint64 haveRead = socket->read(crlf, 2);
- if (haveRead > 0)
- bytes += haveRead;
- - state = AllDoneState;
- +
- + if ((haveRead == 2 && crlf[0] == '\r' && crlf[1] == '\n') || (haveRead == 1 && crlf[0] == '\n'))
- + state = AllDoneState;
- break;
- }
- diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
- index 04e4569..06cac75 100644
- --- a/src/network/access/qhttpnetworkreply_p.h
- +++ b/src/network/access/qhttpnetworkreply_p.h
- @@ -219,6 +219,7 @@ public:
- bool forceConnectionCloseEnabled;
- qint64 currentChunkSize;
- qint64 currentChunkRead;
- + bool lastChunkRead;
- QPointer<QHttpNetworkConnection> connection;
- QPointer<QHttpNetworkConnectionChannel> connectionChannel;
Add Comment
Please, Sign In to add comment