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

Backported fix for LP #257675

parent 1bd955ff
...@@ -31,6 +31,9 @@ Features Added ...@@ -31,6 +31,9 @@ Features Added
Bugs Fixed 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 - Zope 3-style resource directories would throw an Unauthorized error when
trying to use restrictedTraverse() to reach a resource in a sub-directory trying to use restrictedTraverse() to reach a resource in a sub-directory
of the resource directory. of the resource directory.
......
...@@ -478,6 +478,12 @@ class HTTPRequest(BaseRequest): ...@@ -478,6 +478,12 @@ class HTTPRequest(BaseRequest):
other = self.other other = self.other
taintedform = self.taintedform 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 meth = None
fs = ZopeFieldStorage(fp=fp,environ=environ,keep_blank_values=1) fs = ZopeFieldStorage(fp=fp,environ=environ,keep_blank_values=1)
if not hasattr(fs,'list') or fs.list is None: if not hasattr(fs,'list') or fs.list is None:
......
...@@ -128,6 +128,13 @@ class HTTPRequestTests(unittest.TestCase): ...@@ -128,6 +128,13 @@ class HTTPRequestTests(unittest.TestCase):
"Key %s not correctly reproduced in tainted; expected %r, " "Key %s not correctly reproduced in tainted; expected %r, "
"got %r" % (key, req.form[key], req.taintedform[key])) "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): def test_processInputs_wo_marshalling(self):
inputs = ( inputs = (
('foo', 'bar'), ('spam', 'eggs'), ('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