summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qhttpsocketengine.cpp
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@nokia.com>2010-01-25 15:04:11 (GMT)
committerPaul Olav Tvete <paul.tvete@nokia.com>2010-01-25 15:04:11 (GMT)
commit0411ecc38e6c48263de3e5fef2bd8ba3adf61d97 (patch)
treef555609fccea16128797b7951403ba9f459e9b62 /src/network/socket/qhttpsocketengine.cpp
parent5bda4e27bbe3fde98bd5c628fada76dfccadad0e (diff)
parentede20ecdb0ddef7ef239900eb3bfa92ca859e010 (diff)
downloadQt-0411ecc38e6c48263de3e5fef2bd8ba3adf61d97.zip
Qt-0411ecc38e6c48263de3e5fef2bd8ba3adf61d97.tar.gz
Qt-0411ecc38e6c48263de3e5fef2bd8ba3adf61d97.tar.bz2
Merge branch 'master' into staging-1-master
Conflicts: doc/src/getting-started/installation.qdoc
Diffstat (limited to 'src/network/socket/qhttpsocketengine.cpp')
-rw-r--r--src/network/socket/qhttpsocketengine.cpp22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index 5c28318..3293ff5 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -212,28 +212,14 @@ qint64 QHttpSocketEngine::bytesAvailable() const
qint64 QHttpSocketEngine::read(char *data, qint64 maxlen)
{
Q_D(QHttpSocketEngine);
- qint64 bytesRead = 0;
-
- if (!d->readBuffer.isEmpty()) {
- // Read as much from the buffer as we can.
- bytesRead = qMin((qint64)d->readBuffer.size(), maxlen);
- memcpy(data, d->readBuffer.constData(), bytesRead);
- data += bytesRead;
- maxlen -= bytesRead;
- d->readBuffer = d->readBuffer.mid(bytesRead);
- }
-
- qint64 bytesReadFromSocket = d->socket->read(data, maxlen);
+ qint64 bytesRead = d->socket->read(data, maxlen);
if (d->socket->state() == QAbstractSocket::UnconnectedState
&& d->socket->bytesAvailable() == 0) {
emitReadNotification();
}
- if (bytesReadFromSocket > 0) {
- // Add to what we read so far.
- bytesRead += bytesReadFromSocket;
- } else if (bytesRead == 0 && bytesReadFromSocket == -1) {
+ if (bytesRead == -1) {
// If nothing has been read so far, and the direct socket read
// failed, return the socket's error. Otherwise, fall through and
// return as much as we read so far.
@@ -560,7 +546,7 @@ void QHttpSocketEngine::slotSocketReadNotification()
}
QHttpResponseHeader responseHeader(QString::fromLatin1(d->readBuffer));
- d->readBuffer.clear();
+ d->readBuffer.clear(); // we parsed the proxy protocol response. from now on direct socket reading will be done
int statusCode = responseHeader.statusCode();
if (statusCode == 200) {