Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
WMS server: detect correct service URL even if REQUEST_URI is not def…
…ined
  • Loading branch information
wonder-sk committed Jan 12, 2015
1 parent 03edac9 commit 95b4ebc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/server/qgswmsserver.cpp
Expand Up @@ -2656,7 +2656,14 @@ bool QgsWMSServer::checkMaximumWidthHeight() const

QString QgsWMSServer::serviceUrl() const
{
QUrl mapUrl( getenv( "REQUEST_URI" ) );
QString requestUri = getenv( "REQUEST_URI" );
if ( requestUri.isEmpty() )
{
// in some cases (e.g. when running through python's CGIHTTPServer) the REQUEST_URI is not defined
requestUri = QString( getenv( "SCRIPT_NAME" ) ) + "?" + QString( getenv( "QUERY_STRING" ) );
}

QUrl mapUrl( requestUri );
mapUrl.setHost( getenv( "SERVER_NAME" ) );

//Add non-default ports to url
Expand Down

0 comments on commit 95b4ebc

Please sign in to comment.