django1/tests/middleware
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
..
__init__.py Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
cond_get_urls.py Fixed #22218 -- Deprecated django.conf.urls.patterns. 2014-04-03 07:28:10 -04:00
extra_urls.py Fixed #23276 -- Deprecated passing views as strings to url(). 2014-08-12 13:15:40 -04:00
test_security.py Fixed #23620 -- Used more specific assertions in the Django test suite. 2014-11-03 11:56:37 -05:00
tests.py [1.8.x] Fixed #24240 -- Allowed GZipping a Unicode StreamingHttpResponse 2015-02-03 18:19:06 +01:00
urls.py Fixed #23276 -- Deprecated passing views as strings to url(). 2014-08-12 13:15:40 -04:00
views.py Removed executeable bit from a few files. 2014-05-25 23:16:40 +02:00