diff options
author | Jonas M. Gastal <jgastal@profusion.mobi> | 2011-12-22 13:53:38 -0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-09 19:18:08 +0100 |
commit | 159098719b8e8f40d1bd663c61bdc51f883c645f (patch) | |
tree | 028f1bd66b1e055b7a676b52ab2b690692139dae /src/network/access/qnetworkreply.cpp | |
parent | 4669d657d29ae883db746b7cbfed367758943ee9 (diff) |
Using proper virtual functions instead of Q_INVOKABLE tricks.
This mantains BC between version compiled with and without OPENSSL,
which was the reason for the use of "runtime virtuals". Using proper
virtuals should make code clearer.
Change-Id: I24f141ebaab68c000c2d602b54addbae1679a424
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/network/access/qnetworkreply.cpp')
-rw-r--r-- | src/network/access/qnetworkreply.cpp | 69 |
1 files changed, 45 insertions, 24 deletions
diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp index c38414ea44..db62f2935a 100644 --- a/src/network/access/qnetworkreply.cpp +++ b/src/network/access/qnetworkreply.cpp @@ -586,13 +586,7 @@ QVariant QNetworkReply::attribute(QNetworkRequest::Attribute code) const QSslConfiguration QNetworkReply::sslConfiguration() const { QSslConfiguration config; - - // determine if we support this extension - int id = metaObject()->indexOfMethod("sslConfigurationImplementation()"); - if (id != -1) { - void *arr[] = { &config, 0 }; - const_cast<QNetworkReply *>(this)->qt_metacall(QMetaObject::InvokeMetaMethod, id, arr); - } + sslConfigurationImplementation(config); return config; } @@ -602,15 +596,7 @@ QSslConfiguration QNetworkReply::sslConfiguration() const */ void QNetworkReply::setSslConfiguration(const QSslConfiguration &config) { - if (config.isNull()) - return; - - int id = metaObject()->indexOfMethod("setSslConfigurationImplementation(QSslConfiguration)"); - if (id != -1) { - QSslConfiguration copy(config); - void *arr[] = { 0, © }; - qt_metacall(QMetaObject::InvokeMetaMethod, id, arr); - } + setSslConfigurationImplementation(config); } /*! @@ -635,18 +621,53 @@ void QNetworkReply::setSslConfiguration(const QSslConfiguration &config) */ void QNetworkReply::ignoreSslErrors(const QList<QSslError> &errors) { - // do this cryptic trick, because we could not add a virtual method to this class later on - // since that breaks binary compatibility - int id = metaObject()->indexOfMethod("ignoreSslErrorsImplementation(QList<QSslError>)"); - if (id != -1) { - QList<QSslError> copy(errors); - void *arr[] = { 0, © }; - qt_metacall(QMetaObject::InvokeMetaMethod, id, arr); - } + ignoreSslErrorsImplementation(errors); } #endif /*! + \fn void QNetworkReply::sslConfigurationImplementation(QSslConfiguration &configuration) const + \since 5.0 + + This virtual method is provided to enable overriding the behavior of + sslConfiguration(). sslConfiguration() is a public wrapper for this method. + The configuration will be returned in \a configuration. + + \sa sslConfiguration() +*/ +void QNetworkReply::sslConfigurationImplementation(QSslConfiguration &) const +{ +} + +/*! + \fn void QNetworkReply::setSslConfigurationImplementation(const QSslConfiguration &configuration) + \since 5.0 + + This virtual method is provided to enable overriding the behavior of + setSslConfiguration(). setSslConfiguration() is a public wrapper for this method. + If you override this method use \a configuration to set the SSL configuration. + + \sa sslConfigurationImplementation(), setSslConfiguration() +*/ +void QNetworkReply::setSslConfigurationImplementation(const QSslConfiguration &) +{ +} + +/*! + \fn void QNetworkReply::ignoreSslErrorsImplementation(const QList<QSslError> &errors) + \since 5.0 + + This virtual method is provided to enable overriding the behavior of + ignoreSslErrors(). ignoreSslErrors() is a public wrapper for this method. + \a errors contains the errors the user wishes ignored. + + \sa ignoreSslErrors() +*/ +void QNetworkReply::ignoreSslErrorsImplementation(const QList<QSslError> &) +{ +} + +/*! If this function is called, SSL errors related to network connection will be ignored, including certificate validation errors. |