diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2011-03-15 16:09:38 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2011-03-15 16:09:38 (GMT) |
commit | e81c9e62f2052f2584d67827c88a0578fa2e3fab (patch) | |
tree | f6edb1a54e00e5ec8a7987338c25c5a351447c60 /src/network/access | |
parent | c0cd8db0498daaa8151d1f80143b6849016bdc7c (diff) | |
parent | 45c31fee7deea7800a2ef86dad7d6966ee2ceafd (diff) | |
download | Qt-e81c9e62f2052f2584d67827c88a0578fa2e3fab.zip Qt-e81c9e62f2052f2584d67827c88a0578fa2e3fab.tar.gz Qt-e81c9e62f2052f2584d67827c88a0578fa2e3fab.tar.bz2 |
Merge remote-tracking branch 'origin/4.7' into qt-master-from-4.7
Conflicts:
tests/auto/qnetworkreply/tst_qnetworkreply.cpp
Diffstat (limited to 'src/network/access')
-rw-r--r-- | src/network/access/qhttpnetworkconnectionchannel.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 41bc64a..2076d72 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -1004,8 +1004,20 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket } else { errorCode = QNetworkReply::RemoteHostClosedError; } + } else if (state == QHttpNetworkConnectionChannel::ReadingState) { + if (!reply->d_func()->expectContent()) { + // No content expected, this is a valid way to have the connection closed by the server + return; + } + if (reply->contentLength() == -1 && !reply->d_func()->isChunked()) { + // There was no content-length header and it's not chunked encoding, + // so this is a valid way to have the connection closed by the server + return; + } + // ok, we got a disconnect even though we did not expect it + errorCode = QNetworkReply::RemoteHostClosedError; } else { - return; + errorCode = QNetworkReply::RemoteHostClosedError; } break; case QAbstractSocket::SocketTimeoutError: @@ -1033,6 +1045,7 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket if (reply) { reply->d_func()->errorString = errorString; emit reply->finishedWithError(errorCode, errorString); + reply = 0; } // send the next request QMetaObject::invokeMethod(that, "_q_startNextRequest", Qt::QueuedConnection); |