Skip to content

Commit

Permalink
[1.0.X] Fixed #9469 -- Apply the fix from r9189 to the WSGI handler a…
Browse files Browse the repository at this point in the history
…s 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
  • Loading branch information
malcolmt committed Mar 8, 2009
1 parent 7dcf651 commit 244bb7e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions django/core/handlers/wsgi.py
Expand Up @@ -10,7 +10,7 @@
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 = {
Expand Down Expand Up @@ -120,7 +120,9 @@ def __repr__(self):
(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 \
Expand Down

0 comments on commit 244bb7e

Please sign in to comment.