diff options
author | Iain <qt-info@nokia.com> | 2009-08-21 13:23:16 (GMT) |
---|---|---|
committer | Iain <qt-info@nokia.com> | 2009-08-21 13:23:16 (GMT) |
commit | d2cfe342ff109e7135fe2fcb00f60d918a7bfaa5 (patch) | |
tree | 26a2edc99e561721fad57d27f84a2a6c0be73a3c /demos/browser | |
parent | 6df41a9378e39f4d46cee1a085463d55fe2af5aa (diff) | |
parent | ab1df6dea670a60bfef5efd81d6687f9534cfc5d (diff) | |
download | Qt-d2cfe342ff109e7135fe2fcb00f60d918a7bfaa5.zip Qt-d2cfe342ff109e7135fe2fcb00f60d918a7bfaa5.tar.gz Qt-d2cfe342ff109e7135fe2fcb00f60d918a7bfaa5.tar.bz2 |
Merge commit 'origin/master' into symbolVisibility
Diffstat (limited to 'demos/browser')
-rw-r--r-- | demos/browser/browser.pro | 7 | ||||
-rw-r--r-- | demos/browser/networkaccessmanager.cpp | 36 | ||||
-rw-r--r-- | demos/browser/networkaccessmanager.h | 8 |
3 files changed, 47 insertions, 4 deletions
diff --git a/demos/browser/browser.pro b/demos/browser/browser.pro index ca00062..f54afe4 100644 --- a/demos/browser/browser.pro +++ b/demos/browser/browser.pro @@ -90,6 +90,7 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.plist *.icns *.ico *.r sources.path = $$[QT_INSTALL_DEMOS]/browser INSTALLS += target sources -include($$QT_SOURCE_TREE/demos/demobase.pri) - -symbian:TARGET.UID3 = 0xA000CF70 +symbian { + include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) + TARGET.UID3 = 0xA000CF70 +} diff --git a/demos/browser/networkaccessmanager.cpp b/demos/browser/networkaccessmanager.cpp index 3781652..3ce9c08 100644 --- a/demos/browser/networkaccessmanager.cpp +++ b/demos/browser/networkaccessmanager.cpp @@ -57,16 +57,21 @@ #include <QtNetwork/QAuthenticator> #include <QtNetwork/QNetworkDiskCache> #include <QtNetwork/QNetworkProxy> +#include <QtNetwork/QNetworkRequest> #include <QtNetwork/QNetworkReply> #include <QtNetwork/QSslError> NetworkAccessManager::NetworkAccessManager(QObject *parent) - : QNetworkAccessManager(parent) + : QNetworkAccessManager(parent), + requestFinishedCount(0), requestFinishedFromCacheCount(0), requestFinishedPipelinedCount(0), + requestFinishedSecureCount(0) { connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); connect(this, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)), SLOT(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*))); + connect(this, SIGNAL(finished(QNetworkReply *)), + SLOT(requestFinished(QNetworkReply *))); #ifndef QT_NO_OPENSSL connect(this, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)), SLOT(sslErrors(QNetworkReply*, const QList<QSslError>&))); @@ -79,6 +84,35 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent) setCache(diskCache); } +QNetworkReply* NetworkAccessManager::createRequest(Operation op, const QNetworkRequest & req, QIODevice * outgoingData) +{ + QNetworkRequest request = req; // copy so we can modify + // this is a temporary hack until we properly use the pipelining flags from QtWebkit + // pipeline everything! :) + request.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true); + return QNetworkAccessManager::createRequest(op, request, outgoingData); +} + +void NetworkAccessManager::requestFinished(QNetworkReply *reply) +{ + requestFinishedCount++; + + if (reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool() == true) + requestFinishedFromCacheCount++; + + if (reply->attribute(QNetworkRequest::HttpPipeliningWasUsedAttribute).toBool() == true) + requestFinishedPipelinedCount++; + + if (reply->attribute(QNetworkRequest::ConnectionEncryptedAttribute).toBool() == true) + requestFinishedSecureCount++; + + double pctCached = (double(requestFinishedFromCacheCount) * 100.0/ double(requestFinishedCount)); + double pctPipelined = (double(requestFinishedPipelinedCount) * 100.0/ double(requestFinishedCount)); + double pctSecure = (double(requestFinishedSecureCount) * 100.0/ double(requestFinishedCount)); + qDebug("%lli requests [%3.2f%% from cache] [%3.2f%% pipelined] [%3.2f%% SSL/TLS]", requestFinishedCount, pctCached, pctPipelined, pctSecure); + +} + void NetworkAccessManager::loadSettings() { QSettings settings; diff --git a/demos/browser/networkaccessmanager.h b/demos/browser/networkaccessmanager.h index 381cb50..189d6a0 100644 --- a/demos/browser/networkaccessmanager.h +++ b/demos/browser/networkaccessmanager.h @@ -43,6 +43,7 @@ #define NETWORKACCESSMANAGER_H #include <QtNetwork/QNetworkAccessManager> +#include <QtNetwork/QNetworkRequest> class NetworkAccessManager : public QNetworkAccessManager { @@ -51,11 +52,18 @@ class NetworkAccessManager : public QNetworkAccessManager public: NetworkAccessManager(QObject *parent = 0); + virtual QNetworkReply* createRequest ( Operation op, const QNetworkRequest & req, QIODevice * outgoingData = 0 ); + private: QList<QString> sslTrustedHostList; + qint64 requestFinishedCount; + qint64 requestFinishedFromCacheCount; + qint64 requestFinishedPipelinedCount; + qint64 requestFinishedSecureCount; public slots: void loadSettings(); + void requestFinished(QNetworkReply *reply); private slots: void authenticationRequired(QNetworkReply *reply, QAuthenticator *auth); |