Changeset 9795 in ntrip for trunk/BNC/src/bncnetqueryv2.cpp
- Timestamp:
- Jul 22, 2022, 1:34:16 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/bncnetqueryv2.cpp
r9742 r9795 36 36 37 37 bncSettings settings; 38 _sslIgnoreErrors = 39 (Qt::CheckState(settings.value("sslIgnoreErrors").toInt()) == Qt::Checked); 40 41 if (_secure && !QSslSocket::supportsSsl()) { 42 BNC_CORE->slotMessage("No SSL support, install OpenSSL run-time libraries", true); 43 stop(); 44 } 38 _sslIgnoreErrors = (Qt::CheckState(settings.value("sslIgnoreErrors").toInt()) == Qt::Checked); 39 40 if (_secure ) { 41 if (!QSslSocket::supportsSsl()) { 42 BNC_CORE->slotMessage("No SSL support, install OpenSSL run-time libraries", true); 43 stop(); 44 } 45 // Generate filenames to consider a potential client certificate 46 _crtFileName = settings.value("sslClientCertPath").toString() + _url.host() + QString(".%1.crt").arg(_url.port()); 47 _keyFileName = settings.value("sslClientCertPath").toString() + _url.host() + QString(".%1.key").arg(_url.port()); 48 } 49 50 45 51 } 46 52 … … 122 128 if (_url.scheme().isEmpty()) { 123 129 if (_secure) { 130 _url.setPort(443); 124 131 _url.setScheme("https"); 125 132 } … … 134 141 // Network Request 135 142 // --------------- 143 bncSslConfig sslConfig = BNC_SSL_CONFIG; 144 145 if (_secure) { 146 QFile clientCrtFile(_crtFileName); 147 QFile privateKeyFile(_keyFileName); 148 if ( clientCrtFile.exists() && privateKeyFile.exists()) { 149 // set local certificate if available 150 clientCrtFile.open(QIODevice::ReadOnly); 151 QSslCertificate clientCrt(&clientCrtFile); 152 sslConfig.setLocalCertificate(clientCrt); 153 // set private key if available 154 privateKeyFile.open(QIODevice::ReadOnly); 155 QSslKey privateKey(&privateKeyFile, QSsl::Rsa); 156 sslConfig.setPrivateKey(privateKey); 157 } 158 } 159 136 160 QNetworkRequest request; 137 request.setSslConfiguration( BNC_SSL_CONFIG);161 request.setSslConfiguration(sslConfig); 138 162 request.setUrl(_url); 139 163 request.setRawHeader("Host" , _url.host().toLatin1());
Note:
See TracChangeset
for help on using the changeset viewer.