Changeset 11126 in ntrip for trunk/BNC/src/upload/bncuploadcaster.cpp
- Timestamp:
- Oct 24, 2026, 11:14:36 PM (2 weeks ago)
- File:
-
- 1 edited
-
trunk/BNC/src/upload/bncuploadcaster.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/upload/bncuploadcaster.cpp
r10753 r11126 80 80 if (_ntripVersion == "2s") { 81 81 if (!QSslSocket::supportsSsl()) { 82 emit(newMessage(83 "For SSL support please install OpenSSL run-time libraries: Ntrip Version 2 is tried",84 true));85 _ntripVersion == "2";82 // no fallback to Ntrip Version 2: user name and password would be sent 83 // unencrypted although an encrypted connection was configured 84 emit(newMessage(_mountpoint.toLatin1() + "@" + _casterOutHost.toLatin1() + 85 ": No SSL support, please install OpenSSL run-time libraries: no upload", true)); 86 86 } else { 87 87 _secure = true; … … 150 150 const QSslError& err = it.next(); 151 151 msg += err.errorString(); 152 } 153 emit(newMessage(msg.toLatin1(), true)); 152 if (it.hasNext()) { 153 msg += "; "; 154 } 155 } 156 if (_sslIgnoreErrors) { 157 _outSocket->ignoreSslErrors(); 158 msg += " (ignored as configured)"; 159 } 160 emit(newMessage(_mountpoint.toLatin1() + "@" + _casterOutHost.toLatin1() + ": " + msg.toLatin1(), true)); 154 161 } 155 162 } … … 203 210 } 204 211 212 if (_ntripVersion == "2s" && !_secure) { // no SSL support, see constructor 213 return; 214 } 215 205 216 if (_outSocket != 0 && 206 217 _outSocket->state() == QAbstractSocket::ConnectedState) { … … 224 235 _outSocket->setProxy(QNetworkProxy::NoProxy); 225 236 226 if (_sslIgnoreErrors) {227 _outSocket->ignoreSslErrors();228 } else {229 bncSslConfig sslConfig = BNC_SSL_CONFIG;230 QFile clientCrtFile(_crtFileName);231 QFile privateKeyFile(_keyFileName);232 if (clientCrtFile.exists() && privateKeyFile.exists()) {233 // set local certificate234 clientCrtFile.open(QIODevice::ReadOnly);235 QSslCertificate clientCrt(&clientCrtFile);236 sslConfig.setLocalCertificate(clientCrt);237 // setprivatekey if available238 privateKeyFile.open(QIODevice::ReadOnly);239 QSslKey privateKey(&privateKeyFile, QSsl::Rsa);240 sslConfig.setPrivateKey(privateKey);241 }242 _outSocket->setSslConfiguration(sslConfig);243 connect(_outSocket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(slotSslErrors(QList<QSslError>)));244 }237 bncSslConfig sslConfig = BNC_SSL_CONFIG; 238 QFile clientCrtFile(_crtFileName); 239 QFile privateKeyFile(_keyFileName); 240 if ( clientCrtFile.exists() && privateKeyFile.exists()) { 241 // set local certificate 242 clientCrtFile.open(QIODevice::ReadOnly); 243 QSslCertificate clientCrt(&clientCrtFile); 244 sslConfig.setLocalCertificate(clientCrt); 245 // set private key if available 246 privateKeyFile.open(QIODevice::ReadOnly); 247 QSslKey privateKey(&privateKeyFile, QSsl::Rsa); 248 sslConfig.setPrivateKey(privateKey); 249 } 250 _outSocket->setSslConfiguration(sslConfig); 251 // Direct connection: the socket lives in this thread, the caster object in 252 // the main thread. The slot must run during the handshake, both for 253 // ignoreSslErrors() to take effect and to access _outSocket safely. 254 connect(_outSocket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(slotSslErrors(QList<QSslError>)), 255 Qt::DirectConnection); 245 256 246 257 if (!_proxy) {
Note:
See TracChangeset
for help on using the changeset viewer.
