Skip to content
Permalink
Browse files

Adds more tolerance to QGIS mapserver for not fully OGC compliant WxS…

… clients

At the moment QGIS mapserver is relatively strict in interpreting the REQUEST parameter. With this pull QGIS mapserver also accepts non compliant requests not using CamelCase e.g. REQUEST=getcapabilities. This pull does not brake the servers OGC compliance but makes it more tolerant for non-compliant clients. Even the OGC reference implementation (based on deegree ?) is relatively tolerant at this point.
  • Loading branch information
Marco Lechner, in medias res GmbH authored and rldhont committed Apr 23, 2013
1 parent b98db88 commit 1176bbccc9ce4ac0a12523720709a6c6b9a0f247
Showing with 24 additions and 11 deletions.
  1. +24 −11 src/mapserver/qgis_map_serv.cpp
@@ -109,6 +109,19 @@ void printRequestInfos()
{
QgsDebugMsg( "HTTP_USER_AGENT: " + QString( getenv( "HTTP_USER_AGENT" ) ) );
}
if ( getenv( "HTTP_PROXY" ) != NULL )
{
QgsDebugMsg( "HTTP_PROXY: " + QString( getenv( "HTTP_PROXY" ) ) );
}
if ( getenv( "HTTPS_PROXY" ) != NULL )
{
QgsDebugMsg( "HTTPS_PROXY: " + QString( getenv( "HTTPS_PROXY" ) ) );
}
if ( getenv( "NO_PROXY" ) != NULL )
{
QgsDebugMsg( "NO_PROXY: " + QString( getenv( "NO_PROXY" ) ) );
}

#endif //QGSMSDEBUG
}

@@ -316,7 +329,7 @@ int main( int argc, char * argv[] )
continue;
}

if ( request == "GetCapabilities" )
if ( request.toLower() == QString( "GetCapabilities" ).toLower() )
{
QDomDocument capabilitiesDocument;
try
@@ -336,7 +349,7 @@ int main( int argc, char * argv[] )
delete theServer;
continue;
}
else if ( request == "DescribeFeatureType" )
else if ( request.toLower() == QString( "DescribeFeatureType" ).toLower() )
{
QDomDocument describeDocument;
try
@@ -356,7 +369,7 @@ int main( int argc, char * argv[] )
delete theServer;
continue;
}
else if ( request == "GetFeature" )
else if ( request.toLower() == QString( "GetFeature" ).toLower() )
{
//output format for GetFeature
QString outputFormat = parameterMap.value( "OUTPUTFORMAT" );
@@ -383,7 +396,7 @@ int main( int argc, char * argv[] )
continue;
}
}
else if ( request == "Transaction" )
else if ( request.toLower() == QString( "Transaction" ).toLower() )
{
QDomDocument transactionDocument;
try
@@ -433,13 +446,13 @@ int main( int argc, char * argv[] )
}

QString version = parameterMap.value( "VERSION", "1.3.0" );
bool getProjectSettings = ( request == "GetProjectSettings" );
bool getProjectSettings = ( request.toLower() == QString( "GetProjectSettings" ).toLower() );
if ( getProjectSettings )
{
version = "1.3.0"; //getProjectSettings extends WMS 1.3.0 capabilities
}

if ( request == "GetCapabilities" || getProjectSettings )
if ( request.toLower() == QString( "GetCapabilities" ).toLower() || getProjectSettings )
{
const QDomDocument* capabilitiesDocument = capabilitiesCache.searchCapabilitiesDocument( configFilePath, getProjectSettings ? "projectSettings" : version );
if ( !capabilitiesDocument ) //capabilities xml not in cache. Create a new one
@@ -473,7 +486,7 @@ int main( int argc, char * argv[] )
delete theServer;
continue;
}
else if ( request == "GetMap" )
else if ( request.toLower() == QString( "GetMap" ).toLower() )
{
QImage* result = 0;
try
@@ -505,7 +518,7 @@ int main( int argc, char * argv[] )
delete theServer;
continue;
}
else if ( request == "GetFeatureInfo" )
else if ( request.toLower() == QString( "GetFeatureInfo" ).toLower() )
{
QDomDocument featureInfoDoc;
try
@@ -531,7 +544,7 @@ int main( int argc, char * argv[] )
delete theServer;
continue;
}
else if ( request == "GetStyles" || request == "GetStyle" ) // GetStyle for compatibility with earlier QGIS versions
else if ( request.toLower() == QString( "GetStyles" ).toLower() || request.toLower() == QString( "GetStyle" ).toLower() ) // GetStyle for compatibility with earlier QGIS versions
{
try
{
@@ -547,7 +560,7 @@ int main( int argc, char * argv[] )
delete theServer;
continue;
}
else if ( request == "GetLegendGraphic" || request == "GetLegendGraphics" ) // GetLegendGraphics for compatibility with earlier QGIS versions
else if ( request.toLower() == QString( "GetLegendGraphic" ).toLower() || request.toLower() == QString( "GetLegendGraphics" ).toLower() ) // GetLegendGraphics for compatibility with earlier QGIS versions
{
QImage* result = 0;
try
@@ -576,7 +589,7 @@ int main( int argc, char * argv[] )
continue;

}
else if ( request == "GetPrint" )
else if ( request.toLower() == QString( "GetPrint" ).toLower() )
{
QByteArray* printOutput = 0;
try

0 comments on commit 1176bbc

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