Changeset 9714 in ntrip
- Timestamp:
- May 11, 2022, 11:57:15 AM (3 years ago)
- Location:
- trunk/BNC/src/upload
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/upload/bncuploadcaster.cpp
r9713 r9714 36 36 _casterOutPort = outPort; 37 37 _ntripVersion = ntripVersion; 38 (_ntripVersion == "2s") ? _secure = true : _secure = false;39 _postExtension = "";40 38 _userName = userName; 41 39 _password = password; … … 53 51 _isToBeDeleted = false; 54 52 55 if (!QSslSocket::supportsSsl()) {56 BNC_CORE->slotMessage("No SSL support, install OpenSSL run-time libraries", true);57 deleteSafely();58 }59 60 if (_ntripVersion != "1") {61 bncSettings settings;62 63 _sslIgnoreErrors = (Qt::CheckState(settings.value("sslIgnoreErrors").toInt()) == Qt::Checked);64 65 _proxyHost = settings.value("proxyHost").toString();66 _proxyPort = settings.value("proxyPort").toInt();67 if (_secure) {68 _casterOutPort = 443;69 if (!_proxyHost.isEmpty()) {70 _postExtension = QString("https://%1:%2").arg(_casterOutHost).arg(_casterOutPort);71 }72 }73 else {74 if (!_proxyHost.isEmpty()) {75 _postExtension = QString("http://%1:%2").arg(_casterOutHost).arg(_casterOutPort);76 }77 }78 }79 80 53 connect(this, SIGNAL(newMessage(QByteArray,bool)), 81 54 BNC_CORE, SLOT(slotMessage(const QByteArray,bool))); … … 91 64 SLOT(slotNewBytes(const QByteArray,double))); 92 65 } 66 67 bncSettings settings; 68 _sslIgnoreErrors = (Qt::CheckState(settings.value("sslIgnoreErrors").toInt()) == Qt::Checked); 69 _proxyHost = settings.value("proxyHost").toString(); 70 _proxyPort = settings.value("proxyPort").toInt(); 71 (_proxyHost.isEmpty()) ? _proxy = false : _proxy = true; 72 73 if (_ntripVersion == "2s") { 74 _secure = true; 75 if (!QSslSocket::supportsSsl()) { 76 emit(newMessage("For SSL support please install OpenSSL run-time libraries: Ntrip Version 2 is tried", true)); 77 _secure = false; 78 _ntripVersion == "2"; 79 } 80 } else { 81 _secure = false; 82 } 83 84 if (_secure) { 85 _casterOutPort = 443; 86 (_proxy) ? _postExtension = QString("https://%1:%2").arg(_casterOutHost).arg(_casterOutPort) : _postExtension = ""; 87 } 88 else { 89 (_proxy) ? _postExtension = QString("http://%1:%2").arg(_casterOutHost).arg(_casterOutPort) : _postExtension = ""; 90 } 91 93 92 } 94 93 … … 109 108 } 110 109 if (_outSocket) { 111 disconnect(_outSocket, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)),112 this, SLOT(slotProxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)));113 110 delete _outSocket; 114 111 } … … 228 225 229 226 _outSocket = new QSslSocket(); 227 const int timeOut = 5000; // 5 seconds 230 228 if (_sslIgnoreErrors) { 231 229 _outSocket->ignoreSslErrors(); 232 230 } 233 _outSocket->setProxy(QNetworkProxy::NoProxy); // to prevent the usage of system entries231 _outSocket->setProxy(QNetworkProxy::NoProxy); 234 232 _outHost = _casterOutHost; 235 233 _outPort = _casterOutPort; 236 if ( !_proxyHost.isEmpty()) {234 if (_proxy) { 237 235 _outHost = _proxyHost; 238 236 _outPort = _proxyPort; 239 connect(_outSocket, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)),237 connect(_outSocket, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)), 240 238 this, SLOT(slotProxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*))); 241 } 242 243 const int timeOut = 5000; // 5 seconds 244 if (!_secure) { 239 if (_ntripVersion == "1") { 240 emit(newMessage("No proxy support in Ntrip Version 1 upload!",true)); 241 } 242 } 243 244 if (!_secure || _proxy) { 245 245 _outSocket->connectToHost(_outHost, _outPort); 246 246 if (!_outSocket->waitForConnected(timeOut)) { -
trunk/BNC/src/upload/bncuploadcaster.h
r9707 r9714 55 55 bool _secure; 56 56 bool _sslIgnoreErrors; 57 bool _proxy; 57 58 QSslSocket* _outSocket; 58 59 int _sOpenTrial;
Note:
See TracChangeset
for help on using the changeset viewer.