Ignore:
Timestamp:
May 11, 2022, 11:57:15 AM (7 weeks ago)
Author:
stuerze
Message:

minor changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/upload/bncuploadcaster.cpp

    r9713 r9714  
    3636  _casterOutPort = outPort;
    3737  _ntripVersion  = ntripVersion;
    38   (_ntripVersion == "2s") ?  _secure = true : _secure = false;
    39   _postExtension = "";
    4038  _userName      = userName;
    4139  _password      = password;
     
    5351  _isToBeDeleted = false;
    5452
    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 
    8053  connect(this, SIGNAL(newMessage(QByteArray,bool)),
    8154          BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
     
    9164            SLOT(slotNewBytes(const QByteArray,double)));
    9265  }
     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
    9392}
    9493
     
    109108  }
    110109  if (_outSocket) {
    111     disconnect(_outSocket, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)),
    112                this, SLOT(slotProxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)));
    113110    delete _outSocket;
    114111  }
     
    228225
    229226  _outSocket = new QSslSocket();
     227  const int timeOut = 5000;  // 5 seconds
    230228  if (_sslIgnoreErrors) {
    231229    _outSocket->ignoreSslErrors();
    232230  }
    233   _outSocket->setProxy(QNetworkProxy::NoProxy); // to prevent the usage of system entries
     231  _outSocket->setProxy(QNetworkProxy::NoProxy);
    234232  _outHost = _casterOutHost;
    235233  _outPort = _casterOutPort;
    236   if (!_proxyHost.isEmpty()) {
     234  if (_proxy) {
    237235    _outHost = _proxyHost;
    238236    _outPort = _proxyPort;
    239     connect(_outSocket, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)),
     237      connect(_outSocket, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)),
    240238            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) {
    245245    _outSocket->connectToHost(_outHost, _outPort);
    246246    if (!_outSocket->waitForConnected(timeOut)) {
Note: See TracChangeset for help on using the changeset viewer.