Code

Opened 4 years ago

Closed 4 years ago

#14021 closed (duplicate)

GZipMiddleware is incompatible with iterator-style HttpResponse objects

Reported by: jamesh Owned by: nobody
Component: Uncategorized Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

An HttpResponse object that has been initialised with an iterator can only have its content read once. The first line of GZipMiddleware.process_response reads the response body and throws it away:

if response.status_code != 200 or len(response.content) < 200:
    return response

After this point, whether the middleware decides to compress the body or not, the content has been lost.

If the middleware encounters such a response, it should make sure it reads the body at most once.

Attachments (0)

Change History (1)

comment:1 Changed 4 years ago by jamesh

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Sorry, looks like I filed a duplicate. I didn't missed #7581 in my searches.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.