Changeset 9723 in ntrip


Ignore:
Timestamp:
May 19, 2022, 12:30:16 PM (2 years ago)
Author:
stuerze
Message:

minor changes to handle SSL errors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bncnetqueryv2.cpp

    r9722 r9723  
    7474  if (_reply && _reply->error() != QNetworkReply::NoError) {
    7575    _status = error;
     76    if (!_reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray().isEmpty()) {
    7677    emit newMessage(_url.path().toLatin1().replace(0,1,"")  +
    7778                    ": NetQueryV2: server replied: " +
    7879                    _reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray(),
    7980                    true);
     81    } else {
     82      emit newMessage(_url.path().toLatin1().replace(0,1,"")  +
     83                         ": NetQueryV2: server replied: " +
     84                         _reply->errorString().toLatin1(),
     85                         true);
     86    }
    8087  }
    8188  else {
     
    189196    _eventLoop->exec();
    190197  }
     198  if (!_reply) {
     199    return;
     200  }
    191201
    192202  // Check NTRIPv2 error code
     
    196206  }
    197207
     208
    198209  // Append Data
    199210  // -----------
     
    207218void bncNetQueryV2::slotSslErrors(QList<QSslError> errors) {
    208219
    209   QString msg = "SSL Error\n";
     220  QString msg = "SSL Error: ";
    210221  QSslCertificate cert = _reply->sslConfiguration().peerCertificate();
    211222  if (!cert.isNull() &&
     
    224235  }
    225236
    226   QListIterator<QSslError> it(errors); std::cout << "errors.size(): "  << errors.size() << std::endl;
     237  QListIterator<QSslError> it(errors);
    227238  while (it.hasNext()) {
    228239    const QSslError& err = it.next();
    229     msg += "\n" + err.errorString();
     240    msg += err.errorString();
    230241  }
    231242  BNC_CORE->slotMessage(msg.toLatin1(), true);
     
    233244  if (_sslIgnoreErrors) {
    234245    _reply->ignoreSslErrors();
     246    BNC_CORE->slotMessage("BNC ignores SSL errors as configured", true);
    235247  }
    236248  else {
    237249    stop();
    238250  }
    239 }
     251  return;
     252}
Note: See TracChangeset for help on using the changeset viewer.