Skip to content

Commit

Permalink
Merge pull request #34268 from arnaud-morvan/request_body_plus
Browse files Browse the repository at this point in the history
Do not replace plus by space in REQUEST_BODY
  • Loading branch information
pblottiere authored and arnaud-morvan committed Feb 28, 2020
1 parent 7562e63 commit f66af76
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/server/qgsrequesthandler.cpp
Expand Up @@ -252,7 +252,7 @@ void QgsRequestHandler::parseInput()

mRequest.setParameter( attrName.toUpper(), attr.value() );
}
mRequest.setParameter( QStringLiteral( "REQUEST_BODY" ), inputString );
mRequest.setParameter( QStringLiteral( "REQUEST_BODY" ), inputString.replace( '+', QStringLiteral( "%2B" ) ) );
}
}
}
Expand Down
15 changes: 15 additions & 0 deletions tests/src/python/test_qgsserver_request.py
Expand Up @@ -194,6 +194,21 @@ def _check_links(params, method='GET'):
_check_links(params)
_check_links(params, 'POST')

def test_fcgiRequestBody(self):
"""Test request body"""
data = '<Literal>+1</Literal>'
self._set_env({
'SERVER_NAME': 'www.myserver.com',
'SERVICE': 'WFS',
'REQUEST_BODY': data,
'CONTENT_LENGTH': str(len(data)),
'REQUEST_METHOD': 'POST',
})
request = QgsFcgiServerRequest()
response = QgsBufferServerResponse()
self.server.handleRequest(request, response)
self.assertEqual(request.parameter('REQUEST_BODY'), '<Literal>+1</Literal>')

def test_add_parameters(self):
request = QgsServerRequest()
request.setParameter('FOOBAR', 'foobar')
Expand Down

0 comments on commit f66af76

Please sign in to comment.