Re: [Django] #36293: GZipMiddleware buffers streaming responses

17 views
Skip to first unread message

Django

unread,
Nov 3, 2025, 1:29:22 PM11/3/25
to django-...@googlegroups.com
#36293: GZipMiddleware buffers streaming responses
-------------------------------+------------------------------------
Reporter: huoyinghui | Owner: (none)
Type: Bug | Status: new
Component: HTTP handling | Version: dev
Severity: Normal | Resolution:
Keywords: gzip flush | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Jacob Walls):

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

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

Django

unread,
Dec 2, 2025, 10:52:40 AM12/2/25
to django-...@googlegroups.com
#36293: GZipMiddleware buffers streaming responses
-------------------------------+--------------------------------------
Reporter: huoyinghui | Owner: Farhan Ali
Type: Bug | Status: assigned
Component: HTTP handling | Version: dev
Severity: Normal | Resolution:
Keywords: gzip flush | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Farhan Ali):

* owner: (none) => Farhan Ali
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/36293#comment:17>

Django

unread,
Dec 13, 2025, 1:37:41 PM12/13/25
to django-...@googlegroups.com
#36293: GZipMiddleware buffers streaming responses
-------------------------------+--------------------------------------
Reporter: huoyinghui | Owner: Farhan Ali
Type: Bug | Status: assigned
Component: HTTP handling | Version: dev
Severity: Normal | Resolution:
Keywords: gzip flush | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Farhan Ali):

* has_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36293#comment:18>

Django

unread,
Dec 13, 2025, 1:40:55 PM12/13/25
to django-...@googlegroups.com
#36293: GZipMiddleware buffers streaming responses
-------------------------------+--------------------------------------
Reporter: huoyinghui | Owner: Farhan Ali
Type: Bug | Status: assigned
Component: HTTP handling | Version: dev
Severity: Normal | Resolution:
Keywords: gzip flush | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Comment (by Farhan Ali):

https://github.com/django/django/pull/20401
I opened this pr for this.
I added zfile.flush() and updated the example to use batching, which may
prevent the issue with response size.
--
Ticket URL: <https://code.djangoproject.com/ticket/36293#comment:19>

Django

unread,
Feb 10, 2026, 5:39:15 PMFeb 10
to django-...@googlegroups.com
#36293: GZipMiddleware buffers streaming responses
-------------------------------+--------------------------------------
Reporter: huoyinghui | Owner: Farhan Ali
Type: Bug | Status: assigned
Component: HTTP handling | Version: dev
Severity: Normal | Resolution:
Keywords: gzip flush | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 0 => 1
* needs_tests: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36293#comment:20>

Django

unread,
Mar 4, 2026, 5:35:37 PM (5 days ago) Mar 4
to django-...@googlegroups.com
#36293: GZipMiddleware buffers streaming responses
-------------------------------+--------------------------------------
Reporter: huoyinghui | Owner: Farhan Ali
Type: Bug | Status: assigned
Component: HTTP handling | Version: dev
Severity: Normal | Resolution:
Keywords: gzip flush | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 1 => 0

Comment:

A couple tweaks needed in tests.
--
Ticket URL: <https://code.djangoproject.com/ticket/36293#comment:21>

Django

unread,
Mar 7, 2026, 1:05:19 PM (2 days ago) Mar 7
to django-...@googlegroups.com
#36293: GZipMiddleware buffers streaming responses
-------------------------------------+-------------------------------------
Reporter: huoyinghui | Owner: Farhan
| Ali
Type: Bug | Status: assigned
Component: HTTP handling | Version: dev
Severity: Normal | Resolution:
Keywords: gzip flush | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* needs_tests: 1 => 0
* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/36293#comment:22>

Django

unread,
8:41 AM (9 hours ago) 8:41 AM
to django-...@googlegroups.com
#36293: GZipMiddleware buffers streaming responses
-------------------------------------+-------------------------------------
Reporter: huoyinghui | Owner: Farhan
| Ali
Type: Bug | Status: closed
Component: HTTP handling | Version: dev
Severity: Normal | Resolution: fixed
Keywords: gzip flush | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls <jacobtylerwalls@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"12bb16da8fbadac34e2de318cc79d7d765f35a96" 12bb16d]:
{{{#!CommitTicketReference repository=""
revision="12bb16da8fbadac34e2de318cc79d7d765f35a96"
Fixed #36293 -- Avoided buffering streaming responses in GZipMiddleware.

This avoids latency and/or blocking.

The example of streaming a CSV file was rewritten to employ batching for
greater efficiency in all layers (db, HTTP, etc.). The improved
performance from batching should outweigh the drag introduced by an
additional byte for each flush.

Co-authored-by: huoyinghui <huoyi...@users.noreply.github.com>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36293#comment:23>
Reply all
Reply to author
Forward
0 new messages