Opened 5 years ago

Closed 5 years ago

#30567 closed Cleanup/optimization (fixed)

Start passing FileResponse.block_size to wsgi.file_wrapper.

Reported by: Chris Jerdonek Owned by: Piotr Domański
Component: HTTP handling Version: dev
Severity: Normal Keywords: block_size, wsgi.file_wrapper, FileResponse, wsgi
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Chris Jerdonek)

I noticed that Django's FileResponse class has a block_size attribute which can be customized by subclassing: https://github.com/django/django/blob/415e899dc46c2f8d667ff11d3e54eff759eaded4/django/http/response.py#L393

but it's not passed to wsgi.file_wrapper. Only the filelike object is passed:

response = environ['wsgi.file_wrapper'](response.file_to_stream)

(from: https://github.com/django/django/blob/415e899dc46c2f8d667ff11d3e54eff759eaded4/django/core/handlers/wsgi.py#L144 )

Change History (6)

comment:1 by Chris Jerdonek, 5 years ago

Description: modified (diff)

comment:2 by Mariusz Felisiak, 5 years ago

Summary: Start passing FileResponse.block_size to wsgi.file_wrapperStart passing FileResponse.block_size to wsgi.file_wrapper.
Triage Stage: UnreviewedAccepted

Seems reasonable, Thanks (see example-of-wrapper-usage).

comment:3 by Piotr Domański, 5 years ago

Owner: changed from nobody to Piotr Domański
Status: newassigned

comment:4 by Piotr Domański, 5 years ago

Has patch: set
Triage Stage: AcceptedReady for checkin

comment:5 by Piotr Domański, 5 years ago

Triage Stage: Ready for checkinAccepted

comment:6 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

Resolution: fixed
Status: assignedclosed

In 4b4e68a7:

Fixed #30567 -- Made WSGIHandler pass FileResponse.block_size to wsgi.file_wrapper.

Note: See TracTickets for help on using tickets.
Back to Top