Skip to content

Commit 85e9389

Browse files
committed
[WFS provider] Force refresh of GetCapabilities when pressing Connect
The cached response to GetCapabilities was always used, even when pressing Connect. Now a new request is sent over the network. Fixes #15647
1 parent fad3de8 commit 85e9389

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

src/providers/wfs/qgswfscapabilities.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ QgsWFSCapabilities::~QgsWFSCapabilities()
3636
{
3737
}
3838

39-
bool QgsWFSCapabilities::requestCapabilities( bool synchronous )
39+
bool QgsWFSCapabilities::requestCapabilities( bool synchronous, bool forceRefresh )
4040
{
4141
QUrl url( baseURL() );
4242
url.addQueryItem( "REQUEST", "GetCapabilities" );
@@ -48,7 +48,7 @@ bool QgsWFSCapabilities::requestCapabilities( bool synchronous )
4848
else
4949
url.addQueryItem( "VERSION", version );
5050

51-
if ( !sendGET( url, synchronous, false ) )
51+
if ( !sendGET( url, synchronous, forceRefresh ) )
5252
{
5353
emit gotCapabilities();
5454
return false;

src/providers/wfs/qgswfscapabilities.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class QgsWFSCapabilities : public QgsWFSRequest
3030
virtual ~QgsWFSCapabilities();
3131

3232
//! start network connection to get capabilities
33-
bool requestCapabilities( bool synchronous );
33+
bool requestCapabilities( bool synchronous, bool forceRefresh );
3434

3535
//! description of a vector layer
3636
struct FeatureType

src/providers/wfs/qgswfsdataitems.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ QVector<QgsDataItem*> QgsWFSConnectionItem::createChildren()
6262

6363
QgsWFSCapabilities capabilities( mUri );
6464

65-
capabilities.requestCapabilities( true );
65+
const bool synchronous = true;
66+
const bool forceRefresh = false;
67+
capabilities.requestCapabilities( synchronous, forceRefresh );
6668

6769
QVector<QgsDataItem*> layers;
6870
if ( capabilities.errorCode() == QgsWFSCapabilities::NoError )

src/providers/wfs/qgswfsprovider.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,9 @@ bool QgsWFSProvider::getCapabilities()
14341434
if ( mShared->mCaps.version.isEmpty() )
14351435
{
14361436
QgsWFSCapabilities getCapabilities( mShared->mURI.uri( false ) );
1437-
if ( !getCapabilities.requestCapabilities( true ) )
1437+
const bool synchronous = true;
1438+
const bool forceRefresh = false;
1439+
if ( !getCapabilities.requestCapabilities( synchronous, forceRefresh ) )
14381440
{
14391441
QgsMessageLog::logMessage( tr( "GetCapabilities failed for url %1: %2" ).
14401442
arg( dataSourceUri() ).arg( getCapabilities.errorMessage() ), tr( "WFS" ) );

src/providers/wfs/qgswfssourceselect.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,9 @@ void QgsWFSSourceSelect::connectToServer()
354354
}
355355
if ( mCapabilities )
356356
{
357-
mCapabilities->requestCapabilities( false );
357+
const bool synchronous = false;
358+
const bool forceRefresh = true;
359+
mCapabilities->requestCapabilities( synchronous, forceRefresh );
358360
}
359361
}
360362

0 commit comments

Comments
 (0)