Opened 12 years ago
Last modified 12 years ago
#19081 closed Bug
Non-ASCII query string aren't decoded properly — at Version 1
Reported by: | Aymeric Augustin | Owned by: | Aymeric Augustin |
---|---|---|---|
Component: | HTTP handling | Version: | dev |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
In [fcc8de05] I enabled unicode_literals
in django.core.servers.basehttp
.
This turns environ['QUERY_STRING']
into a unicode string, which later on prevents correct decoding in QueryDict
.
A quick'n'dirty, Python 2 only fix is:
diff --git a/django/core/servers/basehttp.py b/django/core/servers/basehttp.py index 19b287a..af8f2a0 100644 --- a/django/core/servers/basehttp.py +++ b/django/core/servers/basehttp.py @@ -144,9 +144,9 @@ class WSGIRequestHandler(simple_server.WSGIRequestHandler, object): env['SERVER_PROTOCOL'] = self.request_version env['REQUEST_METHOD'] = self.command if '?' in self.path: - path,query = self.path.split('?',1) + path, query = self.path.split(b'?', 1) else: - path,query = self.path,'' + path, query = self.path, b'' env['PATH_INFO'] = unquote(path) env['QUERY_STRING'] = query
An audit of this module seems necessary. It may even be extended to django.core.servers
.
Change History (1)
comment:1 by , 12 years ago
Description: | modified (diff) |
---|---|
Patch needs improvement: | set |
Note:
See TracTickets
for help on using tickets.