Skip to content

Commit

Permalink
Fixed a bug where map= was not being published in onlineresource url …
Browse files Browse the repository at this point in the history
…when project files are not in the same dir as cgi
  • Loading branch information
timlinux committed Jun 28, 2011
1 parent 22b367d commit e07596c
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/mapserver/qgswmsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,32 @@ 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;
hrefString = "http://" + QString( getenv( "SERVER_NAME" ) ) + requestUrl + myMap;
}


Expand Down

0 comments on commit e07596c

Please sign in to comment.