1
0
mirror of https://github.com/django/django.git synced 2024-12-27 19:46:22 +00:00
django/django
Matthew Somerville d88c24f436 [1.8.x] Fixed #24240 -- Allowed GZipping a Unicode StreamingHttpResponse
make_bytes() assumed that if the Content-Encoding header is set, then
everything had already been dealt with bytes-wise, but in a streaming
situation this was not necessarily the case.

make_bytes() is only called when necessary when working with a
StreamingHttpResponse iterable, but by that point the middleware has
added the Content-Encoding header and thus make_bytes() tried to call
bytes(value) (and dies). If it had been a normal HttpResponse,
make_bytes() would have been called when the content was set, well
before the middleware set the Content-Encoding header.

This commit removes the special casing when Content-Encoding is set,
allowing unicode strings to be encoded during the iteration before they
are e.g. gzipped. This behaviour was added a long time ago for #4969 and
it doesn't appear to be necessary any more, as everything is correctly
made into bytes at the appropriate places.

Two new tests, to show that supplying non-ASCII characters to a
StreamingHttpResponse works fine normally, and when passed through the
GZip middleware (the latter dies without the change to make_bytes()).
Removes the test with a nonsense Content-Encoding and Unicode input - if
this were to happen, it can still be encoded as bytes fine.

Backport of 250aa7c39b from master.
2015-02-03 18:19:06 +01:00
..
apps [1.8.x] Removed an obsolete comment in django/apps/config.py 2015-01-18 16:31:21 -05:00
bin
conf [1.8.x] Fixed Persian locale FIRST_DAY_OF_WEEK & DECIMAL/THOUSAND_SEPARATORs. 2015-01-29 13:02:49 -05:00
contrib [1.8.x] Removed contrib.auth.forms.mask_password() 2015-02-02 11:13:48 -05:00
core Removed unused import 2015-01-14 09:31:24 +01:00
db [1.8.x] Fixed #23617 -- Added get_pk_value_on_save() 2015-02-03 09:25:55 -05:00
dispatch [1.8.x] Clarified docstring in dispatch/dispatcher.py 2015-01-23 13:00:24 -05:00
forms [1.8.x] Fixed typos in code comments. 2015-01-20 12:18:29 -05:00
http [1.8.x] Fixed #24240 -- Allowed GZipping a Unicode StreamingHttpResponse 2015-02-03 18:19:06 +01:00
middleware [1.8.x] Removed UpdateCacheMiddleware._session_accessed() 2015-02-01 20:35:57 -05:00
template [1.8.x] Fixed #24168 -- Allowed selecting a template engine in a few APIs. 2015-02-03 08:32:14 +01:00
templatetags Cleaned up the django.template namespace. 2014-12-28 14:47:31 +01:00
test [1.8.x] Skipped tests from refs #24168 on Python 3.2. 2015-02-03 08:21:06 -05:00
utils [1.8.x] Removed threading fallback imports. 2015-02-01 18:45:01 -05:00
views [1.8.x] Fixed #24263 -- Prevented extra queries on BaseDateDetailView with a custom queryset. 2015-02-03 09:13:10 -05:00
__init__.py Bumped version to 1.8 alpha 1. 2015-01-16 17:06:32 -05:00
shortcuts.py [1.8.x] Fixed #24168 -- Allowed selecting a template engine in a few APIs. 2015-02-03 08:32:14 +01:00