Skip to content

Commit

Permalink
Server: if map-parameter is missing in post parameters, check if it i…
Browse files Browse the repository at this point in the history
…s passed as a get-parameter. Ported from Sourcepole QGIS Enterprise
  • Loading branch information
mhugent committed Jan 30, 2015
1 parent 57a5794 commit 7246b83
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/server/qgspostrequesthandler.cpp
Expand Up @@ -33,6 +33,19 @@ void QgsPostRequestHandler::parseInput()
QString inputString = readPostBody();
QgsDebugMsg( inputString );

//Map parameter in QUERY_STRING?
const char* qs = getenv( "QUERY_STRING" );
QMap<QString, QString> getParameters;
QString queryString;
QString mapParameter;
if ( qs )
{
queryString = QString( qs );
requestStringToParameterMap( queryString, getParameters );
mapParameter = getParameters.value( "MAP" );
}


QDomDocument doc;
QString errorMsg;
if ( !doc.setContent( inputString, true, &errorMsg ) )
Expand Down Expand Up @@ -64,4 +77,9 @@ void QgsPostRequestHandler::parseInput()
mParameterMap.insert( "REQUEST", docElem.tagName() );
mParameterMap.insert( "REQUEST_BODY", inputString );
}

if ( !mapParameter.isEmpty() && !mParameterMap.contains( "MAP" ) )
{
mParameterMap.insert( "MAP", mapParameter );
}
}

1 comment on commit 7246b83

@luca76
Copy link
Contributor

@luca76 luca76 commented on 7246b83 Feb 2, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, it would be a great fix for 2.8!

Please sign in to comment.