1
0
mirror of https://github.com/django/django.git synced 2024-12-27 03:25:58 +00:00
Go to file
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
.tx [1.8.x] Added contrib.postgres translation catalog 2015-01-18 21:01:42 +01:00
django [1.8.x] Fixed #24240 -- Allowed GZipping a Unicode StreamingHttpResponse 2015-02-03 18:19:06 +01:00
docs [1.8.x] Fixed #23617 -- Added get_pk_value_on_save() 2015-02-03 09:25:55 -05:00
extras Removed extras/csrf_migration_helper.py 2014-06-09 11:53:09 -04:00
scripts Converted Django scripts to argparse 2014-06-09 10:13:37 +02:00
tests [1.8.x] Fixed #24240 -- Allowed GZipping a Unicode StreamingHttpResponse 2015-02-03 18:19:06 +01:00
.gitattributes Force Unix-style line-endings for some helper files in staticfiles_tests. 2013-09-30 22:14:54 -03:00
.gitignore Added __pycache__ to gitignore 2013-09-19 06:37:23 -04:00
.hgignore Sycned .hginore with .gitignore. 2014-04-26 15:39:55 +02:00
AUTHORS [1.8.x] Fixed #24240 -- Allowed GZipping a Unicode StreamingHttpResponse 2015-02-03 18:19:06 +01:00
CONTRIBUTING.rst Fixed #21609 -- Amended CONTRIBUTING.rst pull request guidelines. 2013-12-26 13:41:03 -05:00
INSTALL
LICENSE Whitespace cleanup. 2013-10-10 16:49:20 -04:00
MANIFEST.in Removed formtools entries from MANIFEST.in. 2015-01-03 08:27:48 -05:00
README.rst Converted links to HTTPS and linked to stable docs. 2013-12-29 22:35:37 +01:00
setup.cfg [1.8.x] Removed a flake8 exclude that caused code to be missed. 2015-01-18 20:48:35 -05:00
setup.py Include an 'extra_requires' for bcrypt 2014-04-17 11:28:09 -07:00

Django is a high-level Python Web framework that encourages rapid development
and clean, pragmatic design. Thanks for checking it out.

All documentation is in the "docs" directory and online at
https://docs.djangoproject.com/en/stable/. If you're just getting started,
here's how we recommend you read the docs:

* First, read docs/intro/install.txt for instructions on installing Django.

* Next, work through the tutorials in order (docs/intro/tutorial01.txt,
  docs/intro/tutorial02.txt, etc.).

* If you want to set up an actual deployment server, read
  docs/howto/deployment/index.txt for instructions.

* You'll probably want to read through the topical guides (in docs/topics)
  next; from there you can jump to the HOWTOs (in docs/howto) for specific
  problems, and check out the reference (docs/ref) for gory details.

* See docs/README for instructions on building an HTML version of the docs.

Docs are updated rigorously. If you find any problems in the docs, or think
they should be clarified in any way, please take 30 seconds to fill out a
ticket here: https://code.djangoproject.com/newticket

To get more help:

* Join the #django channel on irc.freenode.net. Lots of helpful people hang out
  there. Read the archives at http://django-irc-logs.com/.

* Join the django-users mailing list, or read the archives, at
  https://groups.google.com/group/django-users.

To contribute to Django:

* Check out https://www.djangoproject.com/community/ for information about
  getting involved.

To run Django's test suite:

* Follow the instructions in the "Unit tests" section of
  docs/internals/contributing/writing-code/unit-tests.txt, published online at
  https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-the-unit-tests