Skip to content

Commit 6eeb8cd

Browse files
committed
Fixed a bug where map= was not being published in onlineresource url when project files are not in the same dir as cgi
1 parent 62714a8 commit 6eeb8cd

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/mapserver/qgswmsserver.cpp

+19-1
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,32 @@ QDomDocument QgsWMSServer::getCapabilities()
106106
//Some client requests already have http://<SERVER_NAME> in the REQUEST_URI variable
107107
QString hrefString;
108108
QString requestUrl = getenv( "REQUEST_URI" );
109+
QString mapUrl = requestUrl;
109110
requestUrl.truncate( requestUrl.indexOf( "?" ) + 1 );
111+
112+
// find out if a map parameter was specified and ensure
113+
// it is propogated to the onlineresource
114+
mapUrl.replace( requestUrl, "" );
115+
QStringList myTokens = mapUrl.split( "&" );
116+
QString myMap = "";
117+
QStringListIterator myIterator( myTokens );
118+
while ( myIterator.hasNext() )
119+
{
120+
QString myString = myIterator.next();
121+
if ( myString.contains( "map=", Qt::CaseInsensitive ) )
122+
{
123+
myMap = myString;
124+
}
125+
}
126+
127+
110128
if ( requestUrl.contains( "http" ) )
111129
{
112130
hrefString = requestUrl;
113131
}
114132
else
115133
{
116-
hrefString = "http://" + QString( getenv( "SERVER_NAME" ) ) + requestUrl;
134+
hrefString = "http://" + QString( getenv( "SERVER_NAME" ) ) + requestUrl + myMap;
117135
}
118136

119137

0 commit comments

Comments
 (0)