Skip to content

Commit b8ff71a

Browse files
committedOct 6, 2016
[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 fffbf78 commit b8ff71a

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed
 

‎src/providers/wfs/qgswfscapabilities.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ QgsWfsCapabilities::~QgsWfsCapabilities()
3535
{
3636
}
3737

38-
bool QgsWfsCapabilities::requestCapabilities( bool synchronous )
38+
bool QgsWfsCapabilities::requestCapabilities( bool synchronous, bool forceRefresh )
3939
{
4040
QUrl url( baseURL() );
4141
url.addQueryItem( "REQUEST", "GetCapabilities" );
@@ -47,7 +47,7 @@ bool QgsWfsCapabilities::requestCapabilities( bool synchronous )
4747
else
4848
url.addQueryItem( "VERSION", version );
4949

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

‎src/providers/wfs/qgswfscapabilities.h

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,9 @@ bool QgsWFSProvider::getCapabilities()
14371437
if ( mShared->mCaps.version.isEmpty() )
14381438
{
14391439
QgsWfsCapabilities getCapabilities( mShared->mURI.uri( false ) );
1440-
if ( !getCapabilities.requestCapabilities( true ) )
1440+
const bool synchronous = true;
1441+
const bool forceRefresh = false;
1442+
if ( !getCapabilities.requestCapabilities( synchronous, forceRefresh ) )
14411443
{
14421444
QgsMessageLog::logMessage( tr( "GetCapabilities failed for url %1: %2" ).
14431445
arg( dataSourceUri() ).arg( getCapabilities.errorMessage() ), tr( "WFS" ) );

‎src/providers/wfs/qgswfssourceselect.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,9 @@ void QgsWFSSourceSelect::connectToServer()
353353
}
354354
if ( mCapabilities )
355355
{
356-
mCapabilities->requestCapabilities( false );
356+
const bool synchronous = false;
357+
const bool forceRefresh = true;
358+
mCapabilities->requestCapabilities( synchronous, forceRefresh );
357359
}
358360
}
359361

0 commit comments

Comments
 (0)