From c32caf8ab78d25978f59fd3b807ae87ab7d921bb Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Wed, 23 Oct 2019 14:27:40 +0200 Subject: [PATCH] Server WMS fix case sensistive REQUEST Fixes #32354 --- src/server/services/wms/qgswms.cpp | 6 +++--- tests/src/python/test_qgsserver_wms.py | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/server/services/wms/qgswms.cpp b/src/server/services/wms/qgswms.cpp index 60099a47a76..1fd5c289620 100644 --- a/src/server/services/wms/qgswms.cpp +++ b/src/server/services/wms/qgswms.cpp @@ -95,8 +95,8 @@ namespace QgsWms } if ( ( mVersion.compare( QLatin1String( "1.1.1" ) ) == 0 \ - && req.compare( QLatin1String( "capabilities" ) ) == 0 ) - || req.compare( QLatin1String( "GetCapabilities" ) ) == 0 ) + && QSTR_COMPARE( req, "capabilities" ) ) + || QSTR_COMPARE( req, "GetCapabilities" ) ) { writeGetCapabilities( mServerIface, project, version, request, response, false ); } @@ -154,7 +154,7 @@ namespace QgsWms { // Operation not supported throw QgsServiceException( QgsServiceException::OGC_OperationNotSupported, - QString( "Request %1 is not supported" ).arg( req ), 501 ); + QStringLiteral( "Request %1 is not supported" ).arg( req ), 501 ); } } diff --git a/tests/src/python/test_qgsserver_wms.py b/tests/src/python/test_qgsserver_wms.py index 6984c04606c..58eb3dfd787 100644 --- a/tests/src/python/test_qgsserver_wms.py +++ b/tests/src/python/test_qgsserver_wms.py @@ -94,6 +94,10 @@ class TestQgsServerWMS(TestQgsServerWMSTestBase): def test_getcapabilities(self): self.wms_request_compare('GetCapabilities') + def test_getcapabilities_case_insensitive(self): + self.wms_request_compare('getcapabilities') + self.wms_request_compare('GETCAPABILITIES') + def test_getprojectsettings(self): self.wms_request_compare('GetProjectSettings')