Merge branch 'issue-1540' into calamares

FIXES #1540
main
Adriaan de Groot 4 years ago
commit d63e23b289

@ -113,7 +113,9 @@ do_query( Handler::Type type, const QString& url, const QString& selector )
return RegionZonePair();
}
return interface->processReply( CalamaresUtils::Network::Manager::instance().synchronousGet( url ) );
using namespace CalamaresUtils::Network;
return interface->processReply(
CalamaresUtils::Network::Manager::instance().synchronousGet( url, { RequestOptions::FakeUserAgent } ) );
}
static QString
@ -125,7 +127,9 @@ do_raw_query( Handler::Type type, const QString& url, const QString& selector )
return QString();
}
return interface->rawReply( CalamaresUtils::Network::Manager::instance().synchronousGet( url ) );
using namespace CalamaresUtils::Network;
return interface->rawReply(
CalamaresUtils::Network::Manager::instance().synchronousGet( url, { RequestOptions::FakeUserAgent } ) );
}
RegionZonePair

@ -11,7 +11,6 @@
* This is a test-application that does one GeoIP parse.
*/
#include <iostream>
#include "GeoIPFixed.h"
#include "GeoIPJSON.h"
@ -19,6 +18,10 @@
#include "GeoIPXML.h"
#endif
#include "utils/Logger.h"
#include <iostream>
using std::cerr;
using namespace CalamaresUtils::GeoIP;
@ -34,6 +37,9 @@ main( int argc, char** argv )
QString format( argv[ 1 ] );
QString selector = argc == 3 ? QString( argv[ 2 ] ) : QString();
Logger::setupLogLevel(Logger::LOGVERBOSE);
cDebug() << "Doing GeoIP interpretation with format=" << format << "selector=" << selector;
Interface* handler = nullptr;
if ( QStringLiteral( "json" ) == format )
{

@ -223,6 +223,7 @@ synchronousRun( QNetworkAccessManager* nam, const QUrl& url, const RequestOption
auto* reply = asynchronousRun( nam, url, options );
if ( !reply )
{
cDebug() << "Could not create request for" << url;
return qMakePair( RequestStatus( RequestStatus::Failed ), nullptr );
}
@ -232,10 +233,12 @@ synchronousRun( QNetworkAccessManager* nam, const QUrl& url, const RequestOption
reply->deleteLater();
if ( reply->isRunning() )
{
cDebug() << "Timeout on request for" << url;
return qMakePair( RequestStatus( RequestStatus::Timeout ), nullptr );
}
else if ( reply->error() != QNetworkReply::NoError )
{
cDebug() << "HTTP error" << reply->error() << "on request for" << url;
return qMakePair( RequestStatus( RequestStatus::HttpError ), nullptr );
}
else

Loading…
Cancel
Save