Skip to content
Permalink
Browse files

[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
  • Loading branch information
rouault committed Oct 6, 2016
1 parent fad3de8 commit 85e9389c0e97cba8648994f96509349f1d37aa31
@@ -36,7 +36,7 @@ QgsWFSCapabilities::~QgsWFSCapabilities()
{
}

bool QgsWFSCapabilities::requestCapabilities( bool synchronous )
bool QgsWFSCapabilities::requestCapabilities( bool synchronous, bool forceRefresh )
{
QUrl url( baseURL() );
url.addQueryItem( "REQUEST", "GetCapabilities" );
@@ -48,7 +48,7 @@ bool QgsWFSCapabilities::requestCapabilities( bool synchronous )
else
url.addQueryItem( "VERSION", version );

if ( !sendGET( url, synchronous, false ) )
if ( !sendGET( url, synchronous, forceRefresh ) )
{
emit gotCapabilities();
return false;
@@ -30,7 +30,7 @@ class QgsWFSCapabilities : public QgsWFSRequest
virtual ~QgsWFSCapabilities();

//! start network connection to get capabilities
bool requestCapabilities( bool synchronous );
bool requestCapabilities( bool synchronous, bool forceRefresh );

//! description of a vector layer
struct FeatureType
@@ -62,7 +62,9 @@ QVector<QgsDataItem*> QgsWFSConnectionItem::createChildren()

QgsWFSCapabilities capabilities( mUri );

capabilities.requestCapabilities( true );
const bool synchronous = true;
const bool forceRefresh = false;
capabilities.requestCapabilities( synchronous, forceRefresh );

QVector<QgsDataItem*> layers;
if ( capabilities.errorCode() == QgsWFSCapabilities::NoError )
@@ -1434,7 +1434,9 @@ bool QgsWFSProvider::getCapabilities()
if ( mShared->mCaps.version.isEmpty() )
{
QgsWFSCapabilities getCapabilities( mShared->mURI.uri( false ) );
if ( !getCapabilities.requestCapabilities( true ) )
const bool synchronous = true;
const bool forceRefresh = false;
if ( !getCapabilities.requestCapabilities( synchronous, forceRefresh ) )
{
QgsMessageLog::logMessage( tr( "GetCapabilities failed for url %1: %2" ).
arg( dataSourceUri() ).arg( getCapabilities.errorMessage() ), tr( "WFS" ) );
@@ -354,7 +354,9 @@ void QgsWFSSourceSelect::connectToServer()
}
if ( mCapabilities )
{
mCapabilities->requestCapabilities( false );
const bool synchronous = false;
const bool forceRefresh = true;
mCapabilities->requestCapabilities( synchronous, forceRefresh );
}
}

0 comments on commit 85e9389

Please sign in to comment.
You can’t perform that action at this time.