Skip to content

Commit

Permalink
Fixes #49179 : convert correcly proxy port when reading ogr layers
Browse files Browse the repository at this point in the history
  • Loading branch information
troopa81 authored and github-actions[bot] committed Aug 30, 2022
1 parent 8398ca8 commit 47013fa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/qgsgdalutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ void QgsGdalUtils::setupProxy()
//excludes = settings.value( QStringLiteral( "proxy/proxyExcludedUrls" ), "" ).toStringList();

const QString proxyHost( proxy.hostName() );
const qint16 proxyPort( proxy.port() );
const quint16 proxyPort( proxy.port() );

const QString proxyUser( proxy.user() );
const QString proxyPassword( proxy.password() );
Expand Down
4 changes: 2 additions & 2 deletions tests/src/core/testqgsogrprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void TestQgsOgrProvider::setupProxy()
QgsSettings settings;
{
settings.setValue( QStringLiteral( "proxy/proxyEnabled" ), true );
settings.setValue( QStringLiteral( "proxy/proxyPort" ), QStringLiteral( "1234" ) );
settings.setValue( QStringLiteral( "proxy/proxyPort" ), QStringLiteral( "38124" ) );
settings.setValue( QStringLiteral( "proxy/proxyHost" ), QStringLiteral( "myproxyhostname.com" ) );
settings.setValue( QStringLiteral( "proxy/proxyUser" ), QStringLiteral( "username" ) );
settings.setValue( QStringLiteral( "proxy/proxyPassword" ), QStringLiteral( "password" ) );
Expand All @@ -92,7 +92,7 @@ void TestQgsOgrProvider::setupProxy()
const QgsVectorLayer vl( mTestDataDir + '/' + QStringLiteral( "lines.shp" ), QStringLiteral( "proxy_test" ), QLatin1String( "ogr" ) );
QVERIFY( vl.isValid() );
const char *proxyConfig = CPLGetConfigOption( "GDAL_HTTP_PROXY", nullptr );
QCOMPARE( proxyConfig, "myproxyhostname.com:1234" );
QCOMPARE( proxyConfig, "myproxyhostname.com:38124" );
const char *proxyCredentials = CPLGetConfigOption( "GDAL_HTTP_PROXYUSERPWD", nullptr );
QCOMPARE( proxyCredentials, "username:password" );
}
Expand Down

0 comments on commit 47013fa

Please sign in to comment.