Skip to content

Commit

Permalink
A neater fix for missing map parameter as suggested by Juergen
Browse files Browse the repository at this point in the history
  • Loading branch information
timlinux committed Jun 28, 2011
1 parent db77166 commit f71f52f
Showing 1 changed file with 6 additions and 27 deletions.
33 changes: 6 additions & 27 deletions src/mapserver/qgswmsserver.cpp
Expand Up @@ -106,33 +106,12 @@ QDomDocument QgsWMSServer::getCapabilities()
//Some client requests already have http://<SERVER_NAME> in the REQUEST_URI variable
QString hrefString;
QString requestUrl = getenv( "REQUEST_URI" );
QString mapUrl = requestUrl;
requestUrl.truncate( requestUrl.indexOf( "?" ) + 1 );

// find out if a map parameter was specified and ensure
// it is propogated to the onlineresource
mapUrl.replace( requestUrl, "" );
QStringList myTokens = mapUrl.split( "&" );
QString myMap = "";
QStringListIterator myIterator( myTokens );
while ( myIterator.hasNext() )
{
QString myString = myIterator.next();
if ( myString.contains( "map=", Qt::CaseInsensitive ) )
{
myMap = myString;
}
}


if ( requestUrl.contains( "http" ) )
{
hrefString = requestUrl;
}
else
{
hrefString = "http://" + QString( getenv( "SERVER_NAME" ) ) + requestUrl + myMap;
}
QUrl mapUrl( requestUrl );
mapUrl.setHost( QString( getenv( "SERVER_NAME" ) ) );
mapUrl.removeQueryItem( "REQUEST" );
mapUrl.removeQueryItem( "VERSION" );
mapUrl.removeQueryItem( "SERVICE" );
hrefString = mapUrl.toString();


// SOAP platform
Expand Down

0 comments on commit f71f52f

Please sign in to comment.