Opened 9 years ago

Last modified 9 years ago

#25623 closed Bug

Django always returns a white page along with 400 on latin encoded URLs. — at Version 1

Reported by: Christian Peters Owned by: nobody
Component: HTTP handling Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Christian Peters)

Given a URL like /Raumh%F6he served with gunicorn and waitress (maybe others as well), django raises a UnicodeDecodeError here:

https://github.com/django/django/blob/master/django/core/handlers/wsgi.py#L200

... which ends up in serving a white page with a 400 (sample: https://www.djangoproject.com/Raumh%F6he)

This does not happen with the built in runserver command, because it double encodes the query, as far as I understand:

https://github.com/django/django/blob/master/django/core/servers/basehttp.py#L154-L157

Gunicorn on the other hand is explicitly casting to latin:

https://github.com/benoitc/gunicorn/blob/master/gunicorn/_compat.py#L82

... which leads to the error as django is explicitly expecting utf-8.

Change History (1)

comment:1 by Christian Peters, 9 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top