Skip to content

Commit

Permalink
Fix WMS identify (headers getters must be case insensitive)
Browse files Browse the repository at this point in the history
Fixes #50981
  • Loading branch information
elpaso authored and nyalldawson committed Nov 25, 2022
1 parent d0903e7 commit c2bba3b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/providers/wms/qgswmsprovider.cpp
Expand Up @@ -3612,17 +3612,26 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPointXY &point, QgsRa
int gmlPart = -1;
int xsdPart = -1;
int jsonPart = -1;

// Headers are case insensitive

for ( int i = 0; i < mIdentifyResultHeaders.size(); i++ )
{
if ( xsdPart == -1 && mIdentifyResultHeaders.at( i ).value( "Content-Disposition" ).contains( ".xsd" ) )
QgsNetworkReplyParser::RawHeaderMap identifyResultHeader;
for ( auto it = mIdentifyResultHeaders.at( i ).cbegin(); it != mIdentifyResultHeaders.at( i ).cend(); ++it )
{
identifyResultHeader.insert( it.key().toLower(), it.value() );
}

if ( xsdPart == -1 && identifyResultHeader.value( "content-disposition" ).contains( ".xsd" ) )
{
xsdPart = i;
}
else if ( gmlPart == -1 && mIdentifyResultHeaders.at( i ).value( "Content-Disposition" ).contains( ".dat" ) )
else if ( gmlPart == -1 && identifyResultHeader.value( "content-disposition" ).contains( ".dat" ) )
{
gmlPart = i;
}
else if ( jsonPart == -1 && mIdentifyResultHeaders.at( i ).value( "Content-Type" ).contains( "json" ) )
else if ( jsonPart == -1 && identifyResultHeader.value( "content-type" ).contains( "json" ) )
{
jsonPart = i;
}
Expand Down

0 comments on commit c2bba3b

Please sign in to comment.