diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-11-12 14:33:33 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-11-12 14:33:33 (GMT) |
commit | 437e83e7707516129f68ee26aca5349845b7cc7b (patch) | |
tree | 0d4c8721f21acc5398e4eabff88a902cb23d0521 /src/network | |
parent | 7b3880475d02bd3db630387bccccc7e1ef9d4e9a (diff) | |
parent | e61071a2a170eaeb524778e9e903100323b88bbe (diff) | |
download | Qt-437e83e7707516129f68ee26aca5349845b7cc7b.zip Qt-437e83e7707516129f68ee26aca5349845b7cc7b.tar.gz Qt-437e83e7707516129f68ee26aca5349845b7cc7b.tar.bz2 |
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts:
configure
doc/src/snippets/code/doc_src_qmake-manual.qdoc
mkspecs/features/symbian/application_icon.prf
mkspecs/features/symbian/default_post.prf
mkspecs/features/symbian/symbian_building.prf
qmake/generators/symbian/initprojectdeploy_symbian.cpp
src/multimedia/audio/audio.pri
src/network/access/qnetworkaccessmanager.cpp
src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
src/opengl/qgl_p.h
src/plugins/bearer/corewlan/qcorewlanengine.mm
src/plugins/phonon/mmf/mmf.pro
tests/auto/qscriptvalue/tst_qscriptvalue.cpp
tests/auto/qscriptvalue/tst_qscriptvalue.h
tools/qdoc3/doc/qdoc-manual.qdocconf
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qnetworkaccessbackend.cpp | 12 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessbackend_p.h | 1 | ||||
-rw-r--r-- | src/network/access/qnetworkaccesscachebackend.cpp | 12 | ||||
-rw-r--r-- | src/network/access/qnetworkaccesscachebackend_p.h | 2 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessdebugpipebackend.cpp | 6 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessdebugpipebackend_p.h | 1 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessfilebackend.cpp | 6 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessfilebackend_p.h | 1 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessftpbackend.cpp | 17 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessftpbackend_p.h | 1 | ||||
-rw-r--r-- | src/network/access/qnetworkaccesshttpbackend.cpp | 20 | ||||
-rw-r--r-- | src/network/access/qnetworkaccesshttpbackend_p.h | 1 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessmanager.cpp | 20 | ||||
-rw-r--r-- | src/network/ssl/qsslsocket_openssl.cpp | 75 | ||||
-rw-r--r-- | src/network/ssl/qsslsocket_openssl_p.h | 1 |
15 files changed, 80 insertions, 96 deletions
diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 86dd59b..d4ecf43 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -88,18 +88,6 @@ QNetworkAccessBackendFactory::~QNetworkAccessBackendFactory() QNetworkAccessBackend *QNetworkAccessManagerPrivate::findBackend(QNetworkAccessManager::Operation op, const QNetworkRequest &request) { - QNetworkRequest::CacheLoadControl mode = - static_cast<QNetworkRequest::CacheLoadControl>( - request.attribute(QNetworkRequest::CacheLoadControlAttribute, - QNetworkRequest::PreferNetwork).toInt()); - if (mode == QNetworkRequest::AlwaysCache - && (op == QNetworkAccessManager::GetOperation - || op == QNetworkAccessManager::HeadOperation)) { - QNetworkAccessBackend *backend = new QNetworkAccessCacheBackend; - backend->manager = this; - return backend; - } - if (!factoryDataShutdown) { QMutexLocker locker(&factoryData()->mutex); QNetworkAccessBackendFactoryData::ConstIterator it = factoryData()->constBegin(), diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 9f8a01f..b9a832e 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -115,7 +115,6 @@ public: virtual bool start(); #endif virtual void closeDownstreamChannel() = 0; - virtual bool waitForDownstreamReadyRead(int msecs) = 0; // slot-like: virtual void downstreamReadyWrite(); diff --git a/src/network/access/qnetworkaccesscachebackend.cpp b/src/network/access/qnetworkaccesscachebackend.cpp index 73491a9..e78694e 100644 --- a/src/network/access/qnetworkaccesscachebackend.cpp +++ b/src/network/access/qnetworkaccesscachebackend.cpp @@ -132,18 +132,6 @@ void QNetworkAccessCacheBackend::closeUpstreamChannel() Q_ASSERT_X(false, Q_FUNC_INFO, "This function show not have been called!"); } -bool QNetworkAccessCacheBackend::waitForDownstreamReadyRead(int) -{ - Q_ASSERT_X(false, Q_FUNC_INFO , "This function show not have been called!"); - return false; -} - -bool QNetworkAccessCacheBackend::waitForUpstreamBytesWritten(int) -{ - Q_ASSERT_X(false, Q_FUNC_INFO, "This function show not have been called!"); - return false; -} - void QNetworkAccessCacheBackend::upstreamReadyRead() { Q_ASSERT_X(false, Q_FUNC_INFO, "This function show not have been called!"); diff --git a/src/network/access/qnetworkaccesscachebackend_p.h b/src/network/access/qnetworkaccesscachebackend_p.h index df001ab..32581d5 100644 --- a/src/network/access/qnetworkaccesscachebackend_p.h +++ b/src/network/access/qnetworkaccesscachebackend_p.h @@ -69,8 +69,6 @@ public: void open(); void closeDownstreamChannel(); void closeUpstreamChannel(); - bool waitForDownstreamReadyRead(int msecs); - bool waitForUpstreamBytesWritten(int msecs); void upstreamReadyRead(); void downstreamReadyWrite(); diff --git a/src/network/access/qnetworkaccessdebugpipebackend.cpp b/src/network/access/qnetworkaccessdebugpipebackend.cpp index cd077e7..5f99f84 100644 --- a/src/network/access/qnetworkaccessdebugpipebackend.cpp +++ b/src/network/access/qnetworkaccessdebugpipebackend.cpp @@ -278,12 +278,6 @@ void QNetworkAccessDebugPipeBackend::socketConnected() { } -bool QNetworkAccessDebugPipeBackend::waitForDownstreamReadyRead(int ms) -{ - Q_UNUSED(ms); - qCritical("QNetworkAccess: Debug pipe backend does not support waitForReadyRead()"); - return false; -} #endif diff --git a/src/network/access/qnetworkaccessdebugpipebackend_p.h b/src/network/access/qnetworkaccessdebugpipebackend_p.h index 58a4fd0..918a813 100644 --- a/src/network/access/qnetworkaccessdebugpipebackend_p.h +++ b/src/network/access/qnetworkaccessdebugpipebackend_p.h @@ -71,7 +71,6 @@ public: virtual void open(); virtual void closeDownstreamChannel(); - virtual bool waitForDownstreamReadyRead(int msecs); virtual void downstreamReadyWrite(); diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp index 710c258..cf4ce7c 100644 --- a/src/network/access/qnetworkaccessfilebackend.cpp +++ b/src/network/access/qnetworkaccessfilebackend.cpp @@ -208,12 +208,6 @@ void QNetworkAccessFileBackend::closeDownstreamChannel() } } -bool QNetworkAccessFileBackend::waitForDownstreamReadyRead(int) -{ - Q_ASSERT(operation() == QNetworkAccessManager::GetOperation); - return readMoreFromFile(); -} - void QNetworkAccessFileBackend::downstreamReadyWrite() { Q_ASSERT_X(operation() == QNetworkAccessManager::GetOperation, "QNetworkAccessFileBackend", diff --git a/src/network/access/qnetworkaccessfilebackend_p.h b/src/network/access/qnetworkaccessfilebackend_p.h index 6df8710..d1dbe8d 100644 --- a/src/network/access/qnetworkaccessfilebackend_p.h +++ b/src/network/access/qnetworkaccessfilebackend_p.h @@ -69,7 +69,6 @@ public: virtual void open(); virtual void closeDownstreamChannel(); - virtual bool waitForDownstreamReadyRead(int msecs); virtual void downstreamReadyWrite(); diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp index da336d0..1567d98 100644 --- a/src/network/access/qnetworkaccessftpbackend.cpp +++ b/src/network/access/qnetworkaccessftpbackend.cpp @@ -182,23 +182,6 @@ void QNetworkAccessFtpBackend::closeDownstreamChannel() #endif } -bool QNetworkAccessFtpBackend::waitForDownstreamReadyRead(int ms) -{ - if (!ftp) - return false; - - if (ftp->bytesAvailable()) { - ftpReadyRead(); - return true; - } - - if (ms == 0) - return false; - - qCritical("QNetworkAccess: FTP backend does not support waitForReadyRead()"); - return false; -} - void QNetworkAccessFtpBackend::downstreamReadyWrite() { if (state == Transferring && ftp && ftp->bytesAvailable()) diff --git a/src/network/access/qnetworkaccessftpbackend_p.h b/src/network/access/qnetworkaccessftpbackend_p.h index 737fa72..8a2bfc3 100644 --- a/src/network/access/qnetworkaccessftpbackend_p.h +++ b/src/network/access/qnetworkaccessftpbackend_p.h @@ -87,7 +87,6 @@ public: virtual void open(); virtual void closeDownstreamChannel(); - virtual bool waitForDownstreamReadyRead(int msecs); virtual void downstreamReadyWrite(); diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index 0ae2192..3c41d85 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -678,26 +678,6 @@ void QNetworkAccessHttpBackend::closeDownstreamChannel() // this indicates that the user closed the stream while the reply isn't finished yet } -bool QNetworkAccessHttpBackend::waitForDownstreamReadyRead(int msecs) -{ - Q_ASSERT(http); - - if (httpReply->bytesAvailable()) { - readFromHttp(); - return true; - } - - if (msecs == 0) { - // no bytes available in the socket and no waiting - return false; - } - - // ### FIXME - qCritical("QNetworkAccess: HTTP backend does not support waitForReadyRead()"); - return false; -} - - void QNetworkAccessHttpBackend::downstreamReadyWrite() { readFromHttp(); diff --git a/src/network/access/qnetworkaccesshttpbackend_p.h b/src/network/access/qnetworkaccesshttpbackend_p.h index ad0a7ba..fd3b2ec 100644 --- a/src/network/access/qnetworkaccesshttpbackend_p.h +++ b/src/network/access/qnetworkaccesshttpbackend_p.h @@ -79,7 +79,6 @@ public: virtual void open(); virtual void closeDownstreamChannel(); - virtual bool waitForDownstreamReadyRead(int msecs); virtual void downstreamReadyWrite(); virtual void setDownstreamLimited(bool b); diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 5ae1078..ade3fe7 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -960,6 +960,26 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera return new QNetworkReplyDataImpl(this, req, op); } + // A request with QNetworkRequest::AlwaysCache does not need any bearer management + QNetworkRequest::CacheLoadControl mode = + static_cast<QNetworkRequest::CacheLoadControl>( + req.attribute(QNetworkRequest::CacheLoadControlAttribute, + QNetworkRequest::PreferNetwork).toInt()); + if (mode == QNetworkRequest::AlwaysCache + && (op == QNetworkAccessManager::GetOperation + || op == QNetworkAccessManager::HeadOperation)) { + // FIXME Implement a QNetworkReplyCacheImpl instead, see QTBUG-15106 + QNetworkReplyImpl *reply = new QNetworkReplyImpl(this); + QNetworkReplyImplPrivate *priv = reply->d_func(); + priv->manager = this; + priv->backend = new QNetworkAccessCacheBackend(); + priv->backend->manager = this->d_func(); + priv->backend->setParent(reply); + priv->backend->reply = priv; + priv->setup(op, req, outgoingData); + return reply; + } + #ifndef QT_NO_BEARERMANAGEMENT // Return a disabled network reply if network access is disabled. // Except if the scheme is empty or file://. diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 2910538..426b07a 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -51,6 +51,7 @@ #include <QtCore/qdebug.h> #include <QtCore/qdir.h> #include <QtCore/qdiriterator.h> +#include <QtCore/qelapsedtimer.h> #include <QtCore/qfile.h> #include <QtCore/qfileinfo.h> #include <QtCore/qmutex.h> @@ -574,7 +575,7 @@ void QSslSocketPrivate::resetDefaultCiphers() #if defined(Q_OS_SYMBIAN) CSymbianCertificateRetriever::CSymbianCertificateRetriever() : CActive(CActive::EPriorityStandard), - iSequenceError(KErrNone) + iCertificatePtr(0,0,0), iSequenceError(KErrNone) { } @@ -618,6 +619,11 @@ void CSymbianCertificateRetriever::doThreadEntryL() iCertStore = CUnifiedCertStore::NewLC(qt_s60GetRFs(), EFalse); iCertFilter = CCertAttributeFilter::NewLC(); + // only interested in CA certs + iCertFilter->SetOwnerType(ECACertificate); + // only interested in X.509 format (we don't support WAP formats) + iCertFilter->SetFormat(EX509Certificate); + // Kick off the sequence by initializing the cert store iState = Initializing; iCertStore->Initialize(iStatus); @@ -637,6 +643,7 @@ void CSymbianCertificateRetriever::doThreadEntryL() TInt CSymbianCertificateRetriever::ThreadEntryPoint(TAny* aParams) { + User::SetCritical(User::EProcessCritical); CTrapCleanup* cleanupStack = CTrapCleanup::New(); CSymbianCertificateRetriever* self = (CSymbianCertificateRetriever*) aParams; @@ -658,7 +665,17 @@ void CSymbianCertificateRetriever::ConstructL() void CSymbianCertificateRetriever::DoCancel() { - // We never cancel the sequence + switch(iState) { + case Initializing: + iCertStore->CancelInitialize(); + break; + case Listing: + iCertStore->CancelList(); + break; + case RetrievingCertificates: + iCertStore->CancelGetCert(); + break; + } } TInt CSymbianCertificateRetriever::RunError(TInt aError) @@ -671,37 +688,51 @@ TInt CSymbianCertificateRetriever::RunError(TInt aError) void CSymbianCertificateRetriever::GetCertificateL() { - CCTCertInfo* certInfo = iCertInfos[iCurrentCertIndex]; - iCertificateData.resize(certInfo->Size()); - TPtr8 des((TUint8*)iCertificateData.data(), 0, iCertificateData.size()); - iCertStore->Retrieve(*certInfo, des, iStatus); - iState = RetrievingCertificates; - SetActive(); + if (iCurrentCertIndex < iCertInfos.Count()) { + CCTCertInfo* certInfo = iCertInfos[iCurrentCertIndex++]; + iCertificateData = QByteArray(); + QT_TRYCATCH_LEAVING(iCertificateData.resize(certInfo->Size())); + iCertificatePtr.Set((TUint8*)iCertificateData.data(), 0, iCertificateData.size()); +#ifdef QSSLSOCKET_DEBUG + qDebug() << "getting " << qt_TDesC2QString(certInfo->Label()) << " size=" << certInfo->Size(); + qDebug() << "format=" << certInfo->CertificateFormat(); + qDebug() << "ownertype=" << certInfo->CertificateOwnerType(); + qDebug() << "type=" << hex << certInfo->Type().iUid; +#endif + iCertStore->Retrieve(*certInfo, iCertificatePtr, iStatus); + iState = RetrievingCertificates; + SetActive(); + } else { + //reached end of list + CActiveScheduler::Stop(); + } } void CSymbianCertificateRetriever::RunL() { +#ifdef QSSLSOCKET_DEBUG + qDebug() << "CSymbianCertificateRetriever::RunL status " << iStatus.Int() << " count " << iCertInfos.Count() << " index " << iCurrentCertIndex; +#endif switch (iState) { case Initializing: + User::LeaveIfError(iStatus.Int()); // initialise fail means pointless to continue iState = Listing; iCertStore->List(iCertInfos, *iCertFilter, iStatus); SetActive(); break; case Listing: + User::LeaveIfError(iStatus.Int()); // listing fail means pointless to continue iCurrentCertIndex = 0; GetCertificateL(); break; case RetrievingCertificates: - iCertificates->append(iCertificateData); - iCertificateData = QByteArray(); - iCurrentCertIndex++; - if (iCurrentCertIndex < iCertInfos.Count()) - GetCertificateL(); + if (iStatus.Int() == KErrNone) + iCertificates->append(iCertificateData); else - // Stop the scheduler to return to the thread entry function - CActiveScheduler::Stop(); + qWarning() << "CSymbianCertificateRetriever: failed to retreive a certificate, error " << iStatus.Int(); + GetCertificateL(); break; } } @@ -710,6 +741,10 @@ void CSymbianCertificateRetriever::RunL() QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates() { ensureInitialized(); +#ifdef QSSLSOCKET_DEBUG + QElapsedTimer timer; + timer.start(); +#endif QList<QSslCertificate> systemCerts; #if defined(Q_OS_MAC) CFArrayRef cfCerts; @@ -808,10 +843,18 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates() retriever->GetCertificates(certs); foreach (const QByteArray &encodedCert, certs) { QSslCertificate cert(encodedCert, QSsl::Der); - if (!cert.isNull()) + if (!cert.isNull()) { +#ifdef QSSLSOCKET_DEBUG + qDebug() << "imported certificate: " << cert.issuerInfo(QSslCertificate::CommonName); +#endif systemCerts.append(cert); + } } #endif +#ifdef QSSLSOCKET_DEBUG + qDebug() << "systemCaCertificates retrieval time " << timer.elapsed() << "ms"; + qDebug() << "imported " << systemCerts.count() << " certificates"; +#endif return systemCerts; } diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h index dec98ae..b59a6c9 100644 --- a/src/network/ssl/qsslsocket_openssl_p.h +++ b/src/network/ssl/qsslsocket_openssl_p.h @@ -165,6 +165,7 @@ private: CCertAttributeFilter* iCertFilter; TInt iCurrentCertIndex; QByteArray iCertificateData; + TPtr8 iCertificatePtr; QList<QByteArray>* iCertificates; TInt iSequenceError; }; |