#24681: BrokenLinkEmailsMiddleware UnicodeDecodeError
-------------------------------------+-------------------------------------
Reporter: Code0x58 | Owner: Code0x58
Type: Bug | Status: assigned
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
BrokenLinkEmailsMiddleware | Unreviewed
UnicodeDecodeError |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Code0x58):
* status: new => assigned
* needs_better_patch: => 0
* needs_tests: => 0
* owner: nobody => Code0x58
* keywords: CommonMiddleware UnicodeDecodeError =>
BrokenLinkEmailsMiddleware UnicodeDecodeError
* needs_docs: => 0
Old description:
> Using Python 2.7.6 and Django 1.7.6 we got an internal server error when
> there were ''Referer'' and non-ASCII ''User-Agent'' headers on a request
> that lead to a 404 response:
> {{{
> Traceback (most recent call last):
> File ".../django/core/handlers/base.py", line 204, in get_response
> response = middleware_method(request, response)
> File ".../django/middleware/common.py", line 156, in process_response
> "IP address: %s\n" % (referer, path, ua, ip),
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0:
> ordinal not in range(128)
> }}}
>
> This is a problem in `BrokenLinkEmailsMiddleware.process_response` that
> goes back to at least
> [https://github.com/django/django/blob/stable/1.4.x/django/middleware/common.py#L103
> 1.4.x] and is still a on
> [https://github.com/django/django/blob/stable/1.8.x/django/middleware/common.py#L144
> 1.8.x].
>
> I have a fix with a test that I will create a pull request for.
New description:
Using Python 2.7.6 and Django 1.7.6 we got an internal server error when
there were ''Referer'' and non-ASCII ''User-Agent'' headers on a request
that lead to a 404 response:
{{{
Traceback (most recent call last):
File ".../django/core/handlers/base.py", line 204, in get_response
response = middleware_method(request, response)
File ".../django/middleware/common.py", line 156, in process_response
"IP address: %s\n" % (referer, path, ua, ip),
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0:
ordinal not in range(128)
}}}
This is a problem goes back to at least
[https://github.com/django/django/blob/stable/1.4.x/django/middleware/common.py#L103
1.4.x] and is still a on
[https://github.com/django/django/blob/stable/1.8.x/django/middleware/common.py#L144
1.8.x].
I have a fix with a test that I will create a pull request for.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/24681#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.4a78d7b6ff1b328445650866257acade%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.