Opened 13 years ago

Closed 13 years ago

#17514 closed Cleanup/optimization (fixed)

GZip middleware lacks tests and sends compressed responses when larger than the original

Reported by: Aaron Cannon Owned by: Aymeric Augustin
Component: Uncategorized Version: dev
Severity: Normal Keywords: gzip, tests
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The GZip middleware does not currently have any tests.

In addition, in some cases it is not efficient to send a compressed response when the data doesn't compress. After the data is compressed, a check should be performed to see if the compressed data is equal to or larger than the original data, and if so, the original data should be returned instead of the compressed data. This will save a minuscule amount of bandwidth, but it will also save the recipient from having to decompress data.

Attachments (2)

middleware_gzip_patch.diff (5.5 KB ) - added by cannona@… 13 years ago.
Patch.
middleware_gzip_patch_with_docs.diff (7.4 KB ) - added by Aaron Cannon 13 years ago.
Same as the previous patch, except I updated the documentation as well. The old documentation did not accurately or comprehensively describe when GZip compression would be applied.

Download all attachments as: .zip

Change History (5)

by cannona@…, 13 years ago

Attachment: middleware_gzip_patch.diff added

Patch.

by Aaron Cannon, 13 years ago

Same as the previous patch, except I updated the documentation as well. The old documentation did not accurately or comprehensively describe when GZip compression would be applied.

comment:1 by Aymeric Augustin, 13 years ago

Triage Stage: UnreviewedAccepted

This would supersede #10762.

comment:2 by Aymeric Augustin, 13 years ago

Owner: changed from nobody to Aymeric Augustin

comment:3 by Aymeric Augustin, 13 years ago

Resolution: fixed
Status: newclosed

In [17365]:

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.

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