Skip to content
Permalink
Browse files

[auth] Reorganize SSL error integration

  • Loading branch information
dakcarto committed Oct 6, 2015
1 parent 6a7332f commit c7574462a42bd38434cdf82b6babc4ac8679a84d
Showing with 6 additions and 6 deletions.
  1. +6 −6 src/core/qgsnetworkaccessmanager.cpp
@@ -171,25 +171,25 @@ QNetworkReply *QgsNetworkAccessManager::createRequest( QNetworkAccessManager::Op

#ifndef QT_NO_OPENSSL
bool ishttps = pReq->url().scheme().toLower() == "https";
QgsAuthConfigSslServer servconfig;
if ( ishttps && !QgsAuthManager::instance()->isDisabled() )
{
QgsDebugMsg( "Adding trusted CA certs to request" );
QSslConfiguration sslconfig( pReq->sslConfiguration() );
sslconfig.setCaCertificates( QgsAuthManager::instance()->getTrustedCaCertsCache() );

// check for SSL cert custom config
QString hostport( QString( "%1:%2" )
.arg( pReq->url().host().trimmed() )
.arg( pReq->url().port() != -1 ? pReq->url().port() : 443 ) );
servconfig = QgsAuthManager::instance()->getSslCertCustomConfigByHost( hostport.trimmed() );

QgsDebugMsg( "Adding trusted CA certs to request" );
QSslConfiguration sslconfig( pReq->sslConfiguration() );
sslconfig.setCaCertificates( QgsAuthManager::instance()->getTrustedCaCertsCache() );
QgsAuthConfigSslServer servconfig = QgsAuthManager::instance()->getSslCertCustomConfigByHost( hostport.trimmed() );
if ( !servconfig.isNull() )
{
QgsDebugMsg( QString( "Adding SSL custom config to request for %1" ).arg( hostport ) );
sslconfig.setProtocol( servconfig.sslProtocol() );
sslconfig.setPeerVerifyMode( servconfig.sslPeerVerifyMode() );
sslconfig.setPeerVerifyDepth( servconfig.sslPeerVerifyDepth() );
}

pReq->setSslConfiguration( sslconfig );
}
#endif

0 comments on commit c757446

Please sign in to comment.
You can’t perform that action at this time.