summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2009-08-07 08:58:10 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2009-08-20 08:52:37 (GMT)
commit09138f1f4eb45c196506ab94a455dc47cec3575a (patch)
tree946d928f7cfc8413b85e55d06e93ec11308efb9c
parent3ab10cf8690c1ab8ca4692338d7264f81fd5918b (diff)
downloadQt-09138f1f4eb45c196506ab94a455dc47cec3575a.zip
Qt-09138f1f4eb45c196506ab94a455dc47cec3575a.tar.gz
Qt-09138f1f4eb45c196506ab94a455dc47cec3575a.tar.bz2
QNAM HTTP Code: Allow to specify the amount of TCP connections
We will use this for auto testing. Reviewed-by: Thiago
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp22
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h5
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp4
3 files changed, 26 insertions, 5 deletions
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 36906a8..6888891 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -65,19 +65,32 @@
QT_BEGIN_NAMESPACE
-const int QHttpNetworkConnectionPrivate::channelCount = 6;
+const int QHttpNetworkConnectionPrivate::defaultChannelCount = 6;
QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &hostName, quint16 port, bool encrypt)
: hostName(hostName), port(port), encrypt(encrypt),
+ channelCount(defaultChannelCount),
pendingAuthSignal(false), pendingProxyAuthSignal(false)
#ifndef QT_NO_NETWORKPROXY
, networkProxy(QNetworkProxy::NoProxy)
#endif
+{
+ channels = new QHttpNetworkConnectionChannel[channelCount];
+}
+QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(quint16 channelCount, const QString &hostName, quint16 port, bool encrypt)
+: hostName(hostName), port(port), encrypt(encrypt),
+ channelCount(channelCount),
+ pendingAuthSignal(false), pendingProxyAuthSignal(false)
+#ifndef QT_NO_NETWORKPROXY
+ , networkProxy(QNetworkProxy::NoProxy)
+#endif
{
channels = new QHttpNetworkConnectionChannel[channelCount];
}
+
+
QHttpNetworkConnectionPrivate::~QHttpNetworkConnectionPrivate()
{
for (int i = 0; i < channelCount; ++i) {
@@ -573,6 +586,13 @@ QHttpNetworkConnection::QHttpNetworkConnection(const QString &hostName, quint16
d->init();
}
+QHttpNetworkConnection::QHttpNetworkConnection(quint16 connectionCount, const QString &hostName, quint16 port, bool encrypt, QObject *parent)
+ : QObject(*(new QHttpNetworkConnectionPrivate(connectionCount, hostName, port, encrypt)), parent)
+{
+ Q_D(QHttpNetworkConnection);
+ d->init();
+}
+
QHttpNetworkConnection::~QHttpNetworkConnection()
{
}
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index ec8e1b4..3f928ec 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -89,6 +89,7 @@ class Q_AUTOTEST_EXPORT QHttpNetworkConnection : public QObject
public:
QHttpNetworkConnection(const QString &hostName, quint16 port = 80, bool encrypt = false, QObject *parent = 0);
+ QHttpNetworkConnection(quint16 channelCount, const QString &hostName, quint16 port = 80, bool encrypt = false, QObject *parent = 0);
~QHttpNetworkConnection();
//The hostname to which this is connected to.
@@ -153,7 +154,9 @@ class QHttpNetworkConnectionPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QHttpNetworkConnection)
public:
+ static const int defaultChannelCount;
QHttpNetworkConnectionPrivate(const QString &hostName, quint16 port, bool encrypt);
+ QHttpNetworkConnectionPrivate(quint16 channelCount, const QString &hostName, quint16 port, bool encrypt);
~QHttpNetworkConnectionPrivate();
void init();
@@ -189,7 +192,7 @@ public:
quint16 port;
bool encrypt;
- static const int channelCount;
+ const int channelCount;
QHttpNetworkConnectionChannel *channels; // parallel connections to the server
bool pendingAuthSignal; // there is an incomplete authentication signal
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index ed602c4..2d33527 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -41,6 +41,7 @@
#include "qhttpnetworkconnection_p.h"
#include "qhttpnetworkconnectionchannel_p.h"
+#include "private/qnoncontiguousbytedevice_p.h"
#include <qpair.h>
#include <qdebug.h>
@@ -51,9 +52,6 @@
# include <QtNetwork/qsslkey.h>
# include <QtNetwork/qsslcipher.h>
# include <QtNetwork/qsslconfiguration.h>
-
-#include "private/qnoncontiguousbytedevice_p.h"
-
#endif
QT_BEGIN_NAMESPACE