forked from Flowee/registry
Lie to ipfs to make them give us data
also add some logging.
This commit is contained in:
@@ -18,11 +18,13 @@ void DownloadJob::start()
|
||||
{
|
||||
assert(m_sourceUrl.isValid());
|
||||
QNetworkRequest request(m_sourceUrl);
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36");
|
||||
auto reply = m_net->get(request);
|
||||
connect (reply, &QNetworkReply::finished, this, [=]() {
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
// TODO mark file as not available somehow.
|
||||
logCritical() << "Download failed" << m_sourceUrl.toString();
|
||||
logCritical() << reply->errorString();
|
||||
}
|
||||
else {
|
||||
QFileInfo info(m_targetFilePath);
|
||||
@@ -39,6 +41,16 @@ void DownloadJob::start()
|
||||
deleteLater();
|
||||
emit this->finished();
|
||||
});
|
||||
|
||||
connect (reply, &QNetworkReply::errorOccurred, this, [=](QNetworkReply::NetworkError error) {
|
||||
logFatal() << "error occurred" << error;
|
||||
});
|
||||
connect (reply, &QNetworkReply::sslErrors, this, [=](const QList<QSslError> &error) {
|
||||
logFatal() << "ssl errors";
|
||||
for (const auto &e : error) {
|
||||
logFatal() << e.error() << e.errorString();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
QString DownloadJob::targetFilePath() const
|
||||
|
||||
Reference in New Issue
Block a user