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 fffbf78 commit b8ff71af4671165b61fa4f9a7f652e38e4f8bb18
@@ -35,7 +35,7 @@ QgsWfsCapabilities::~QgsWfsCapabilities()
{
}

bool QgsWfsCapabilities::requestCapabilities( bool synchronous )
bool QgsWfsCapabilities::requestCapabilities( bool synchronous, bool forceRefresh )
{
QUrl url( baseURL() );
url.addQueryItem( "REQUEST", "GetCapabilities" );
@@ -47,7 +47,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 )
@@ -1437,7 +1437,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" ) );
@@ -353,7 +353,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 b8ff71a

Please sign in to comment.