Skip to content
Permalink
Browse files

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

…e-3_12

[backport 3.12] Do not replace plus by space in REQUEST_BODY
  • Loading branch information
rldhont committed Mar 3, 2020
2 parents 04ecf6a + f66af76 commit 9ec86b69874f058c3bb79c483750fa3524e5a8ef
Showing with 16 additions and 1 deletion.
  1. +1 −1 src/server/qgsrequesthandler.cpp
  2. +15 −0 tests/src/python/test_qgsserver_request.py
@@ -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" ) ) );
}
}
}
@@ -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 9ec86b6

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