Commit 8a65bbf1 authored by Hanno Schlichting's avatar Hanno Schlichting

Backported fix for LP #257675

parent 1bd955ff
......@@ -31,6 +31,9 @@ Features Added
Bugs Fixed
++++++++++
- LP #257675: request.form contained '-C':'' when no QUERY_STRING was in
the environment.
- Zope 3-style resource directories would throw an Unauthorized error when
trying to use restrictedTraverse() to reach a resource in a sub-directory
of the resource directory.
......
......@@ -478,6 +478,12 @@ class HTTPRequest(BaseRequest):
other = self.other
taintedform = self.taintedform
# If 'QUERY_STRING' is not present in environ
# FieldStorage will try to get it from sys.argv[1]
# which is not what we need.
if not environ.has_key('QUERY_STRING'):
environ['QUERY_STRING'] = ''
meth = None
fs = ZopeFieldStorage(fp=fp,environ=environ,keep_blank_values=1)
if not hasattr(fs,'list') or fs.list is None:
......
......@@ -128,6 +128,13 @@ class HTTPRequestTests(unittest.TestCase):
"Key %s not correctly reproduced in tainted; expected %r, "
"got %r" % (key, req.form[key], req.taintedform[key]))
def test_processInputs_wo_query_string(self):
env = {'SERVER_NAME': 'testingharnas', 'SERVER_PORT': '80'}
req = self._makeOne(environ=env)
req.processInputs()
self._noFormValuesInOther(req)
self.assertEquals(req.form, {})
def test_processInputs_wo_marshalling(self):
inputs = (
('foo', 'bar'), ('spam', 'eggs'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment