@@ -76,7 +76,7 @@ class QgsNetworkProxyFactory : public QNetworkProxyFactory
76
76
77
77
Q_FOREACH ( const QString &exclude, nam->excludeList () )
78
78
{
79
- if ( url.startsWith ( exclude ) )
79
+ if ( !exclude. trimmed (). isEmpty () && url.startsWith ( exclude ) )
80
80
{
81
81
QgsDebugMsgLevel ( QStringLiteral ( " using default proxy for %1 [exclude %2]" ).arg ( url, exclude ), 4 );
82
82
return QList<QNetworkProxy>() << QNetworkProxy ();
@@ -172,6 +172,13 @@ void QgsNetworkAccessManager::setFallbackProxyAndExcludes( const QNetworkProxy &
172
172
173
173
mFallbackProxy = proxy;
174
174
mExcludedURLs = excludes;
175
+ // remove empty records from excludes list -- these would otherwise match ANY url, so the proxy would always be skipped!
176
+ mExcludedURLs .erase ( std::remove_if ( mExcludedURLs .begin (), mExcludedURLs .end (), // clazy:exclude=detaching-member
177
+ []( const QString & url )
178
+ {
179
+ return url.trimmed ().isEmpty ();
180
+ } ), mExcludedURLs .end () ); // clazy:exclude=detaching-member
181
+
175
182
}
176
183
177
184
QNetworkReply *QgsNetworkAccessManager::createRequest ( QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *outgoingData )
@@ -448,7 +455,7 @@ void QgsNetworkAccessManager::setupDefaultProxyAndCache( Qt::ConnectionType conn
448
455
bool proxyEnabled = settings.value ( QStringLiteral ( " proxy/proxyEnabled" ), false ).toBool ();
449
456
if ( proxyEnabled )
450
457
{
451
- excludes = settings.value ( QStringLiteral ( " proxy/proxyExcludedUrls" ), " " ).toStringList ();
458
+ excludes = settings.value ( QStringLiteral ( " proxy/proxyExcludedUrls" ), QStringList () ).toStringList ();
452
459
453
460
// read type, host, port, user, passw from settings
454
461
QString proxyHost = settings.value ( QStringLiteral ( " proxy/proxyHost" ), " " ).toString ();
0 commit comments