Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 1176bbc
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions src/mapserver/qgis_map_serv.cpp
Expand Up @@ -109,6 +109,19 @@ void printRequestInfos()
{ {
QgsDebugMsg( "HTTP_USER_AGENT: " + QString( getenv( "HTTP_USER_AGENT" ) ) ); 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 #endif //QGSMSDEBUG
} }


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


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


QString version = parameterMap.value( "VERSION", "1.3.0" ); QString version = parameterMap.value( "VERSION", "1.3.0" );
bool getProjectSettings = ( request == "GetProjectSettings" ); bool getProjectSettings = ( request.toLower() == QString( "GetProjectSettings" ).toLower() );
if ( getProjectSettings ) if ( getProjectSettings )
{ {
version = "1.3.0"; //getProjectSettings extends WMS 1.3.0 capabilities 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 ); const QDomDocument* capabilitiesDocument = capabilitiesCache.searchCapabilitiesDocument( configFilePath, getProjectSettings ? "projectSettings" : version );
if ( !capabilitiesDocument ) //capabilities xml not in cache. Create a new one if ( !capabilitiesDocument ) //capabilities xml not in cache. Create a new one
Expand Down Expand Up @@ -473,7 +486,7 @@ int main( int argc, char * argv[] )
delete theServer; delete theServer;
continue; continue;
} }
else if ( request == "GetMap" ) else if ( request.toLower() == QString( "GetMap" ).toLower() )
{ {
QImage* result = 0; QImage* result = 0;
try try
Expand Down Expand Up @@ -505,7 +518,7 @@ int main( int argc, char * argv[] )
delete theServer; delete theServer;
continue; continue;
} }
else if ( request == "GetFeatureInfo" ) else if ( request.toLower() == QString( "GetFeatureInfo" ).toLower() )
{ {
QDomDocument featureInfoDoc; QDomDocument featureInfoDoc;
try try
Expand All @@ -531,7 +544,7 @@ int main( int argc, char * argv[] )
delete theServer; delete theServer;
continue; 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 try
{ {
Expand All @@ -547,7 +560,7 @@ int main( int argc, char * argv[] )
delete theServer; delete theServer;
continue; 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; QImage* result = 0;
try try
Expand Down Expand Up @@ -576,7 +589,7 @@ int main( int argc, char * argv[] )
continue; continue;


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

0 comments on commit 1176bbc

Please sign in to comment.