Add debugging code for ssl errors.

This commit is contained in:
Adam Treat 2023-04-24 17:52:19 -04:00
parent c9888a285e
commit 1b0eac2870
4 changed files with 20 additions and 0 deletions

View File

@ -25,6 +25,8 @@ Download::Download()
&HashAndSaveFile::hashAndSave, Qt::QueuedConnection);
connect(m_hashAndSave, &HashAndSaveFile::hashAndSaveFinished, this,
&Download::handleHashAndSaveFinished, Qt::QueuedConnection);
connect(&m_networkManager, &QNetworkAccessManager::sslErrors, this,
&Download::handleSslErrors);
updateModelList();
}
@ -128,6 +130,13 @@ void Download::cancelDownload(const QString &modelFile)
}
}
void Download::handleSslErrors(QNetworkReply *reply, const QList<QSslError> &errors)
{
QUrl url = reply->request().url();
for (auto e : errors)
qWarning() << "ERROR: Received ssl error:" << e.errorString() << "for" << url;
}
void Download::handleJsonDownloadFinished()
{
#if 0

View File

@ -61,6 +61,7 @@ public:
Q_INVOKABLE QString downloadLocalModelsPath() const;
private Q_SLOTS:
void handleSslErrors(QNetworkReply *reply, const QList<QSslError> &errors);
void handleJsonDownloadFinished();
void handleDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
void handleModelDownloadFinished();

View File

@ -28,6 +28,8 @@ Network::Network()
settings.setValue("uniqueId", m_uniqueId);
settings.sync();
setActive(settings.value("network/isActive", false).toBool());
connect(&m_networkManager, &QNetworkAccessManager::sslErrors, this,
&Network::handleSslErrors);
}
void Network::setActive(bool b)
@ -126,6 +128,13 @@ void Network::handleJsonUploadFinished()
jsonReply->deleteLater();
}
void Network::handleSslErrors(QNetworkReply *reply, const QList<QSslError> &errors)
{
QUrl url = reply->request().url();
for (auto e : errors)
qWarning() << "ERROR: Received ssl error:" << e.errorString() << "for" << url;
}
bool Network::sendConversation(const QString &ingestId, const QString &conversation)
{
return packageAndSendJson(ingestId, conversation);

View File

@ -25,6 +25,7 @@ Q_SIGNALS:
private Q_SLOTS:
void handleHealthFinished();
void handleJsonUploadFinished();
void handleSslErrors(QNetworkReply *reply, const QList<QSslError> &errors);
private:
void sendHealth();