[Django] #19153: Deprecate GzipMiddleware

19 views
Skip to first unread message

Django

unread,
Oct 19, 2012, 6:17:36 PM10/19/12
to django-...@googlegroups.com
#19153: Deprecate GzipMiddleware
------------------------------------------------+------------------------
Reporter: aaugustin | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: HTTP handling | Version: master
Severity: Normal | Keywords:
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
Per [http://www.python.org/dev/peps/pep-3333/#other-http-features PEP
3333]:

> applications and middleware must not apply any kind of Transfer-Encoding
to their output, such as chunking or gzipping; as "hop-by-hop" operations,
these encodings are the province of the actual web server/gateway.

Since WSGI has become by far the most common way to deploy Django — I
don't even know any other way — Django should stop providing
`GzipMiddleware`.

This idea was approved by a BDFL on IRC:

{{{
20-00:10:33 jacobkm Oh and +1 on deprecating gzip middleware
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/19153>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 20, 2012, 2:23:46 PM10/20/12
to django-...@googlegroups.com
#19153: Deprecate GzipMiddleware
--------------------------------------+------------------------------------

Reporter: aaugustin | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by claudep):

* has_patch: 0 => 1


Comment:

https://github.com/django/django/pull/455

--
Ticket URL: <https://code.djangoproject.com/ticket/19153#comment:1>

Django

unread,
Oct 26, 2012, 8:19:58 AM10/26/12
to django-...@googlegroups.com
#19153: Deprecate GzipMiddleware
-------------------------------------+-------------------------------------
Reporter: aaugustin | Owner: nobody
Type: | Status: new
Cleanup/optimization | Version: master
Component: HTTP handling | Resolution:
Severity: Normal | Triage Stage: Ready for
Keywords: | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Elvard):

* stage: Accepted => Ready for checkin


Comment:

Doesn't merge cleanly against master, since docs/releases/1.5.txt is
probably intensively updated before release.
Patch works anyway.

--
Ticket URL: <https://code.djangoproject.com/ticket/19153#comment:2>

Django

unread,
Oct 26, 2012, 8:40:58 AM10/26/12
to django-...@googlegroups.com
#19153: Deprecate GzipMiddleware
--------------------------------------+------------------------------------

Reporter: aaugustin | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by aaugustin):

* stage: Ready for checkin => Accepted


Comment:

If it doesn't merge then it isn't ready for checkin :)

I created a ticket instead of doing it myself because I think this
deserves a serious discussion. Even though gzipping at the application
level in wrong in theory, tons of people are doing it and it works in
practice.

I'd like to see a discussion on django-developers before proceeding with
this deprecation.

--
Ticket URL: <https://code.djangoproject.com/ticket/19153#comment:3>

Django

unread,
Oct 31, 2012, 10:37:00 AM10/31/12
to django-...@googlegroups.com
#19153: Deprecate GzipMiddleware
--------------------------------------+------------------------------------

Reporter: aaugustin | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Elvard):

Oh, I'm sorry, the problem with merge was only in docs/releases/1.5.txt
and it was trivial one.

--
Ticket URL: <https://code.djangoproject.com/ticket/19153#comment:4>

Django

unread,
Feb 1, 2013, 4:57:57 PM2/1/13
to django-...@googlegroups.com
#19153: Deprecate GzipMiddleware
--------------------------------------+------------------------------------

Reporter: aaugustin | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by aaugustin):

Since filing this bug, I've come across a use case for GzipMiddleware.

It requires running Django with `USE_ETAGS = True` behind nginx, with gzip
compression enabled. In this situation, nginx will remove the etag (in
modern versions) or keep it unchanged (in older versions). To get the
correct behavior — ie. gzipping if the client supports it, and a different
etag for the gzipped and non-gzipped version — you have to do the
compression in Django.

Related: #19705 and #16035.

--
Ticket URL: <https://code.djangoproject.com/ticket/19153#comment:5>

Django

unread,
Jul 12, 2013, 3:30:08 PM7/12/13
to django-...@googlegroups.com
#19153: Deprecate GzipMiddleware
--------------------------------------+------------------------------------

Reporter: aaugustin | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by timo):

Should we mark this as "won't fix" then?

--
Ticket URL: <https://code.djangoproject.com/ticket/19153#comment:6>

Django

unread,
Aug 5, 2013, 1:04:31 PM8/5/13
to django-...@googlegroups.com
#19153: Deprecate GzipMiddleware
--------------------------------------+------------------------------------
Reporter: aaugustin | Owner: nobody
Type: Cleanup/optimization | Status: closed

Component: HTTP handling | Version: master
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timo):

* status: new => closed
* resolution: => wontfix


--
Ticket URL: <https://code.djangoproject.com/ticket/19153#comment:7>

Django

unread,
Apr 11, 2018, 1:58:47 PM4/11/18
to django-...@googlegroups.com
#19153: Deprecate GzipMiddleware
--------------------------------------+------------------------------------
Reporter: Aymeric Augustin | Owner: nobody
Type: Cleanup/optimization | Status: closed

Component: HTTP handling | Version: master
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by alubbock):

This is an old ticket, but I thought it worth noting that recent versions
of nginx will now downgrade the Django-generated etag to a "weak" etag
rather than deleting it altogether when using nginx's gzip. At least for
nginx users, this seems to remove the need for gzip middleware.

--
Ticket URL: <https://code.djangoproject.com/ticket/19153#comment:8>

Reply all
Reply to author
Forward
0 new messages