summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-10-07 10:55:02 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-10-07 10:55:02 +0000
commit3963a01697f301629f336fb88a96ca326f6697e6 (patch)
treeda47f411b5ab3d8d0394865ad24310f59a5dd7c0
parentfb4f82f2eabe29f9fa27612f485b3be8f497c107 (diff)
[1.0.X] Fixed #9224 -- Prevent a crash when certain query strings are sent using
modpython. Backport of r9189 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@9190 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/core/handlers/modpython.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/django/core/handlers/modpython.py b/django/core/handlers/modpython.py
index d1fdf5259d..c89f202c77 100644
--- a/django/core/handlers/modpython.py
+++ b/django/core/handlers/modpython.py
@@ -6,7 +6,7 @@ from django.core import signals
from django.core.handlers.base import BaseHandler
from django.core.urlresolvers import set_script_prefix
from django.utils import datastructures
-from django.utils.encoding import force_unicode, smart_str
+from django.utils.encoding import force_unicode, smart_str, iri_to_uri
# NOTE: do *not* import settings (or any module which eventually imports
# settings) until after ModPythonHandler has been called; otherwise os.environ
@@ -64,7 +64,9 @@ class ModPythonRequest(http.HttpRequest):
unicode(cookies), unicode(meta)))
def get_full_path(self):
- return '%s%s' % (self.path, self._req.args and ('?' + self._req.args) or '')
+ # RFC 3986 requires self._req.args to be in the ASCII range, but this
+ # doesn't always happen, so rather than crash, we defensively encode it.
+ return '%s%s' % (self.path, self._req.args and ('?' + iri_to_uri(self._req.args)) or '')
def is_secure(self):
try: