summaryrefslogtreecommitdiffstats
path: root/src/network/access/qhttpnetworkrequest.cpp
diff options
context:
space:
mode:
authorPeter Hartmann <phartmann@blackberry.com>2013-06-11 10:45:41 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-24 10:04:14 +0200
commit48345e5d3c07d6dca12dd4ccee18fa3e0ca0ebda (patch)
treee1810808ff02ed3d101df29aa6f5593c7c5adead /src/network/access/qhttpnetworkrequest.cpp
parenta418a544ce1050a85d4a04981e363ce91a8e4211 (diff)
HTTP internals: do not open too many sockets when preconnecting
Each pair of (normal request, preconnect request) requires only one socket. E.g. if there is 1 preconnect request in-flight and 2 normal requests, we need only 2 sockets in total, and not 3. Therefore, we need to keep track of whether a request is preconnecting or a normal one. Task-number: QTBUG-31594 Change-Id: If92ccc35abadfa6090d64ee92bd466615909c94c Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'src/network/access/qhttpnetworkrequest.cpp')
-rw-r--r--src/network/access/qhttpnetworkrequest.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp
index e5b2eced99..f26559ce9b 100644
--- a/src/network/access/qhttpnetworkrequest.cpp
+++ b/src/network/access/qhttpnetworkrequest.cpp
@@ -49,7 +49,8 @@ QT_BEGIN_NAMESPACE
QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op,
QHttpNetworkRequest::Priority pri, const QUrl &newUrl)
: QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), uploadByteDevice(0),
- autoDecompress(false), pipeliningAllowed(false), withCredentials(true)
+ autoDecompress(false), pipeliningAllowed(false), withCredentials(true),
+ preConnect(false)
{
}
@@ -64,6 +65,7 @@ QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(const QHttpNetworkRequest
customVerb = other.customVerb;
withCredentials = other.withCredentials;
ssl = other.ssl;
+ preConnect = other.preConnect;
}
QHttpNetworkRequestPrivate::~QHttpNetworkRequestPrivate()
@@ -75,7 +77,8 @@ bool QHttpNetworkRequestPrivate::operator==(const QHttpNetworkRequestPrivate &ot
return QHttpNetworkHeaderPrivate::operator==(other)
&& (operation == other.operation)
&& (ssl == other.ssl)
- && (uploadByteDevice == other.uploadByteDevice);
+ && (uploadByteDevice == other.uploadByteDevice)
+ && (preConnect == other.preConnect);
}
QByteArray QHttpNetworkRequestPrivate::methodName() const
@@ -205,6 +208,15 @@ void QHttpNetworkRequest::setSsl(bool s)
d->ssl = s;
}
+bool QHttpNetworkRequest::isPreConnect() const
+{
+ return d->preConnect;
+}
+void QHttpNetworkRequest::setPreConnect(bool preConnect)
+{
+ d->preConnect = preConnect;
+}
+
qint64 QHttpNetworkRequest::contentLength() const
{
return d->contentLength();