@@ -112,6 +112,17 @@ MerginApi::MerginApi( LocalProjectsManager &localProjects, QObject *parent )
112112 }
113113 } );
114114
115+ #ifndef QT_NO_SSL
116+ QObject::connect (mManager , &QNetworkAccessManager::sslErrors, this , []( QNetworkReply *reply, const QList<QSslError> &errors )
117+ {
118+ CoreUtils::log ( " URL attempting to access:" , reply->url ().toString ());
119+ for ( const auto &error : errors )
120+ {
121+ CoreUtils::log ( " Error Description:" , error.errorString () );
122+ }
123+ } );
124+ #endif
125+
115126 //
116127 // check if the cache is up to date:
117128 // - server url and type
@@ -1887,27 +1898,6 @@ void MerginApi::pingMergin()
18871898 request.setUrl ( url );
18881899
18891900 QNetworkReply *reply = mManager ->get ( request );
1890- #ifndef QT_NO_SSL
1891- connect ( reply, &QNetworkReply::sslErrors, this , [url]( const QList<QSslError> &errors )
1892- {
1893- CoreUtils::log ( " URL attempting to access:" , url.toString () );
1894- for ( const auto &error : errors )
1895- {
1896- CoreUtils::log ( " Error Description:" , error.errorString () );
1897- // Get the certificate causing the error
1898- QSslCertificate cert = error.certificate ();
1899- if ( !cert.isNull () )
1900- {
1901- CoreUtils::log ( " Subject (Common Name):" , cert.subjectInfo ( QSslCertificate::CommonName ).join ( " ," ) );
1902- CoreUtils::log ( " Issuer (Common Name):" , cert.issuerInfo ( QSslCertificate::CommonName ).join ( " ," ) );
1903- CoreUtils::log ( " Organization:" , cert.subjectInfo ( QSslCertificate::Organization ).join ( " ," ) );
1904- CoreUtils::log ( " Valid From:" , cert.effectiveDate ().toString () );
1905- CoreUtils::log ( " Expires On:" , cert.expiryDate ().toString () );
1906- CoreUtils::log ( " Fingerprint (SHA256):" , cert.digest ( QCryptographicHash::Sha256 ).toHex () );
1907- }
1908- }
1909- } );
1910- #endif
19111901 CoreUtils::log ( " ping" , QStringLiteral ( " Requesting: " ) + url.toString () );
19121902 connect ( reply, &QNetworkReply::finished, this , &MerginApi::pingMerginReplyFinished );
19131903}
0 commit comments