summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2010-03-16 11:24:30 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2010-03-16 13:09:09 (GMT)
commitc640e500ed34e9267c654e52fcc1f7a15b9b30e9 (patch)
tree082dc6611b5fba6e87fa26c54a82e9b557a817bb /src/network
parentfc335fa5e2011df51fc3f4d33f0358dbf2786371 (diff)
downloadQt-c640e500ed34e9267c654e52fcc1f7a15b9b30e9.zip
Qt-c640e500ed34e9267c654e52fcc1f7a15b9b30e9.tar.gz
Qt-c640e500ed34e9267c654e52fcc1f7a15b9b30e9.tar.bz2
QNAM HTTP: Fix no-headers and HTTP-100 handling
Reviewed-by: Thiago
Diffstat (limited to 'src/network')
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp1
-rw-r--r--src/network/access/qhttpnetworkreply.cpp19
-rw-r--r--src/network/access/qhttpnetworkreply_p.h1
3 files changed, 17 insertions, 4 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 806452c..1d8224c 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -353,6 +353,7 @@ void QHttpNetworkConnectionChannel::_q_receiveReply()
replyPrivate->autoDecompress = false;
}
if (replyPrivate->statusCode == 100) {
+ replyPrivate->clearHttpLayerInformation();
replyPrivate->state = QHttpNetworkReplyPrivate::ReadingStatusState;
break; // ignore
}
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index 984f557..338236e 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -219,7 +219,7 @@ QHttpNetworkReplyPrivate::~QHttpNetworkReplyPrivate()
{
}
-void QHttpNetworkReplyPrivate::clear()
+void QHttpNetworkReplyPrivate::clearHttpLayerInformation()
{
state = NothingDoneState;
statusCode = 100;
@@ -229,18 +229,24 @@ void QHttpNetworkReplyPrivate::clear()
currentChunkSize = 0;
currentChunkRead = 0;
connectionCloseEnabled = true;
- connection = 0;
- connectionChannel = 0;
#ifndef QT_NO_COMPRESS
if (initInflate)
inflateEnd(&inflateStrm);
#endif
initInflate = false;
streamEnd = false;
- autoDecompress = false;
fields.clear();
}
+// TODO: Isn't everything HTTP layer related? We don't need to set connection and connectionChannel to 0 at all
+void QHttpNetworkReplyPrivate::clear()
+{
+ connection = 0;
+ connectionChannel = 0;
+ autoDecompress = false;
+ clearHttpLayerInformation();
+}
+
// QHttpNetworkReplyPrivate
qint64 QHttpNetworkReplyPrivate::bytesAvailable() const
{
@@ -539,6 +545,11 @@ qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket)
|| fragment.endsWith("\r\n\n")
|| fragment.endsWith("\n\n"))
allHeaders = true;
+
+ // there is another case: We have no headers. Then the fragment equals just the line ending
+ if ((fragment.length() == 2 && fragment.endsWith("\r\n"))
+ || (fragment.length() == 1 && fragment.endsWith("\n")))
+ allHeaders = true;
}
}
} while (!allHeaders && haveRead > 0);
diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
index fa240ec..4011c78 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -172,6 +172,7 @@ public:
bool findChallenge(bool forProxy, QByteArray &challenge) const;
QAuthenticatorPrivate::Method authenticationMethod(bool isProxy) const;
void clear();
+ void clearHttpLayerInformation();
qint64 readReplyBodyRaw(QIODevice *in, QByteDataBuffer *out, qint64 size);
qint64 readReplyBodyChunked(QIODevice *in, QByteDataBuffer *out);