Opened 3 years ago

Closed 3 years ago

#17514 closed Cleanup/optimization (fixed)

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

Reported by: cannona Owned by: aaugustin
Component: Uncategorized Version: master
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@… 3 years ago.
Patch.
middleware_gzip_patch_with_docs.diff (7.4 KB) - added by cannona 3 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)

Changed 3 years ago by cannona@…

Patch.

Changed 3 years ago by cannona

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 Changed 3 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

This would supersede #10762.

comment:2 Changed 3 years ago by aaugustin

  • Owner changed from nobody to aaugustin

comment:3 Changed 3 years ago by aaugustin

  • Resolution set to fixed
  • Status changed from new to closed

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