summaryrefslogtreecommitdiffstats
path: root/src/network/access/qhttpnetworkconnectionchannel.cpp
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2010-02-15 08:24:36 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2010-02-15 08:24:36 (GMT)
commit22157cb26419ddcaa927cbfa88ad04486b1d1ee0 (patch)
treef84ff6878248c791319fc6be1f1956f2177b5bdb /src/network/access/qhttpnetworkconnectionchannel.cpp
parentfa6dc19b9212706532f3f88da0fb3542e9c3eafe (diff)
parenta14b8805945c5e00be26092406a468fd8b8acc14 (diff)
downloadQt-22157cb26419ddcaa927cbfa88ad04486b1d1ee0.zip
Qt-22157cb26419ddcaa927cbfa88ad04486b1d1ee0.tar.gz
Qt-22157cb26419ddcaa927cbfa88ad04486b1d1ee0.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
Diffstat (limited to 'src/network/access/qhttpnetworkconnectionchannel.cpp')
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 70a301d..b0e632a 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -286,7 +286,6 @@ void QHttpNetworkConnectionChannel::_q_receiveReply()
if (!socket->bytesAvailable()) {
if (reply && reply->d_func()->state == QHttpNetworkReplyPrivate::ReadingDataState) {
reply->d_func()->state = QHttpNetworkReplyPrivate::AllDoneState;
- this->state = QHttpNetworkConnectionChannel::IdleState;
allDone();
} else {
// try to reconnect/resend before sending an error.
@@ -305,9 +304,12 @@ void QHttpNetworkConnectionChannel::_q_receiveReply()
while (socket->bytesAvailable()) {
QHttpNetworkReplyPrivate::ReplyState state = reply ? reply->d_func()->state : QHttpNetworkReplyPrivate::AllDoneState;
switch (state) {
- case QHttpNetworkReplyPrivate::NothingDoneState:
- case QHttpNetworkReplyPrivate::ReadingStatusState: {
+ case QHttpNetworkReplyPrivate::NothingDoneState: {
+ // only eat whitespace on the first call
eatWhitespace();
+ state = reply->d_func()->state = QHttpNetworkReplyPrivate::ReadingStatusState;
+ }
+ case QHttpNetworkReplyPrivate::ReadingStatusState: {
qint64 statusBytes = reply->d_func()->readStatus(socket);
if (statusBytes == -1 && reconnectAttempts <= 0) {
// too many errors reading/receiving/parsing the status, close the socket and emit error
@@ -344,7 +346,6 @@ void QHttpNetworkConnectionChannel::_q_receiveReply()
emit reply->headerChanged();
if (!replyPrivate->expectContent()) {
replyPrivate->state = QHttpNetworkReplyPrivate::AllDoneState;
- this->state = QHttpNetworkConnectionChannel::IdleState;
allDone();
return;
}
@@ -421,7 +422,6 @@ void QHttpNetworkConnectionChannel::_q_receiveReply()
// everything done, fall through
}
case QHttpNetworkReplyPrivate::AllDoneState:
- this->state = QHttpNetworkConnectionChannel::IdleState;
allDone();
break;
default:
@@ -567,6 +567,9 @@ void QHttpNetworkConnectionChannel::allDone()
// in case of failures, each channel will attempt two reconnects before emitting error.
reconnectAttempts = 2;
+ // now the channel can be seen as free/idle again, all signal emissions for the reply have been done
+ this->state = QHttpNetworkConnectionChannel::IdleState;
+
detectPipeliningSupport();
// move next from pipeline to current request
@@ -607,19 +610,19 @@ void QHttpNetworkConnectionChannel::allDone()
void QHttpNetworkConnectionChannel::detectPipeliningSupport()
{
// detect HTTP Pipelining support
- QByteArray serverHeaderField = reply->headerField("Server");
+ QByteArray serverHeaderField;
if (
- // check for broken servers in server reply header
- // this is adapted from http://mxr.mozilla.org/firefox/ident?i=SupportsPipelining
- (!serverHeaderField.contains("Microsoft-IIS/4."))
- && (!serverHeaderField.contains("Microsoft-IIS/5."))
- && (!serverHeaderField.contains("Netscape-Enterprise/3."))
// check for HTTP/1.1
- && (reply->d_func()->majorVersion == 1 && reply->d_func()->minorVersion == 1)
+ (reply->d_func()->majorVersion == 1 && reply->d_func()->minorVersion == 1)
// check for not having connection close
&& (!reply->d_func()->isConnectionCloseEnabled())
// check if it is still connected
&& (socket->state() == QAbstractSocket::ConnectedState)
+ // check for broken servers in server reply header
+ // this is adapted from http://mxr.mozilla.org/firefox/ident?i=SupportsPipelining
+ && (serverHeaderField = reply->headerField("Server"), !serverHeaderField.contains("Microsoft-IIS/4."))
+ && (!serverHeaderField.contains("Microsoft-IIS/5."))
+ && (!serverHeaderField.contains("Netscape-Enterprise/3."))
) {
pipeliningSupported = QHttpNetworkConnectionChannel::PipeliningProbablySupported;
} else {