Skip to content
Permalink
Browse files

Merge pull request #34771 from arnaud-morvan/backport-34268-to-releas…

…e-3_10

[backport 3.10] Do not replace plus by space in REQUEST_BODY
  • Loading branch information
rldhont committed Mar 3, 2020
2 parents a1a5ed3 + 4dea14c commit fb3efd878acd512fb5b932af84543c2f86f61c51
Showing with 16 additions and 1 deletion.
  1. +1 −1 src/server/qgsrequesthandler.cpp
  2. +15 −0 tests/src/python/test_qgsserver_request.py
@@ -245,7 +245,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" ) ) );
}
}
else
@@ -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')

0 comments on commit fb3efd8

Please sign in to comment.
You can’t perform that action at this time.