diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2009-03-08 10:01:22 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2009-03-08 10:01:22 +0000 |
| commit | 244bb7e6012d0cc37557efaee90adb5c7e885306 (patch) | |
| tree | 7435d5b2591bac00b09f62bd527cf7fe0e056c2b /django | |
| parent | 7dcf651bc5ea1b8da5f6b5044b71552dcdaf73cb (diff) | |
[1.0.X] Fixed #9469 -- Apply the fix from r9189 to the WSGI handler as well.
This is a defensive encoding fix. No functionality change for correct URLs.
Patch from magneto.
Backport of r9996 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@9999 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/handlers/wsgi.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/django/core/handlers/wsgi.py b/django/core/handlers/wsgi.py index 5ccbcc6b55..927b098815 100644 --- a/django/core/handlers/wsgi.py +++ b/django/core/handlers/wsgi.py @@ -10,7 +10,7 @@ from django.core import signals from django.core.handlers import base from django.core.urlresolvers import set_script_prefix from django.utils import datastructures -from django.utils.encoding import force_unicode +from django.utils.encoding import force_unicode, iri_to_uri # See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html STATUS_CODE_TEXT = { @@ -120,7 +120,9 @@ class WSGIRequest(http.HttpRequest): (get, post, cookies, meta) def get_full_path(self): - return '%s%s' % (self.path, self.environ.get('QUERY_STRING', '') and ('?' + self.environ.get('QUERY_STRING', '')) or '') + # RFC 3986 requires query string arguments to be in the ASCII range. + # Rather than crash if this doesn't happen, we encode defensively. + return '%s%s' % (self.path, self.environ.get('QUERY_STRING', '') and ('?' + iri_to_uri(self.environ.get('QUERY_STRING', ''))) or '') def is_secure(self): return 'wsgi.url_scheme' in self.environ \ |
