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());
|
assert(m_sourceUrl.isValid());
|
||||||
QNetworkRequest request(m_sourceUrl);
|
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);
|
auto reply = m_net->get(request);
|
||||||
connect (reply, &QNetworkReply::finished, this, [=]() {
|
connect (reply, &QNetworkReply::finished, this, [=]() {
|
||||||
if (reply->error() != QNetworkReply::NoError) {
|
if (reply->error() != QNetworkReply::NoError) {
|
||||||
// TODO mark file as not available somehow.
|
// TODO mark file as not available somehow.
|
||||||
logCritical() << "Download failed" << m_sourceUrl.toString();
|
logCritical() << "Download failed" << m_sourceUrl.toString();
|
||||||
|
logCritical() << reply->errorString();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QFileInfo info(m_targetFilePath);
|
QFileInfo info(m_targetFilePath);
|
||||||
@@ -39,6 +41,16 @@ void DownloadJob::start()
|
|||||||
deleteLater();
|
deleteLater();
|
||||||
emit this->finished();
|
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
|
QString DownloadJob::targetFilePath() const
|
||||||
|
|||||||
Reference in New Issue
Block a user