summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-01-09 21:42:03 +0000
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-01-09 21:42:03 +0000
commit4288c8831bde86f1be581d65c13e2f878a02c7ff (patch)
tree95ab09b0b56909a2cca1ff483c911f8884040011 /docs
parent62766f42482f5071e7af1a806ae5c287f2332921 (diff)
Fixed #10762, #17514 -- Prevented the GZip middleware from returning a response longer than the original content, allowed compression of non-200 responses, and added tests (there were none). Thanks cannona for the initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17365 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/middleware.txt21
1 files changed, 14 insertions, 7 deletions
diff --git a/docs/ref/middleware.txt b/docs/ref/middleware.txt
index 737e0b2598..d57dbc9adc 100644
--- a/docs/ref/middleware.txt
+++ b/docs/ref/middleware.txt
@@ -82,22 +82,29 @@ addresses defined in the :setting:`INTERNAL_IPS` setting. This is used by
Django's :doc:`automatic documentation system </ref/contrib/admin/admindocs>`.
Depends on :class:`~django.contrib.auth.middleware.AuthenticationMiddleware`.
-GZIP middleware
+GZip middleware
---------------
.. module:: django.middleware.gzip
- :synopsis: Middleware to serve gziped content for performance.
+ :synopsis: Middleware to serve GZipped content for performance.
.. class:: GZipMiddleware
-Compresses content for browsers that understand gzip compression (all modern
+Compresses content for browsers that understand GZip compression (all modern
browsers).
It is suggested to place this first in the middleware list, so that the
-compression of the response content is the last thing that happens. Will not
-compress content bodies less than 200 bytes long, when the response code is
-something other than 200, JavaScript files (for IE compatibility), or
-responses that have the ``Content-Encoding`` header already specified.
+compression of the response content is the last thing that happens.
+
+It will not compress content bodies less than 200 bytes long, when the
+``Content-Encoding`` header is already set, or when the browser does not send
+an ``Accept-Encoding`` header containing ``gzip``.
+
+Content will also not be compressed when the browser is Internet Explorer and
+the ``Content-Type`` header contains ``javascript`` or starts with anything
+other than ``text/``. This is done to overcome a bug present in early versions
+of Internet Explorer which caused decompression not to be performed on certain
+content types.
GZip compression can be applied to individual views using the
:func:`~django.views.decorators.http.gzip_page()` decorator.