Page MenuHomePhabricator

Compress file downloads if the client sends "Accept-Encoding: gzip" and we guess the file might compress alright
ClosedPublic

Authored by epriestley on Apr 15 2020, 6:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 3, 10:16 AM
Unknown Object (File)
Thu, Apr 25, 3:43 AM
Unknown Object (File)
Sun, Apr 21, 3:50 AM
Unknown Object (File)
Sat, Apr 20, 5:13 PM
Unknown Object (File)
Thu, Apr 11, 10:52 AM
Unknown Object (File)
Mar 31 2024, 11:17 PM
Unknown Object (File)
Mar 28 2024, 1:30 AM
Unknown Object (File)
Mar 23 2024, 12:52 PM
Subscribers
None

Details

Summary

Ref T13507. We currently compress normal responses, but do not compress file data responses because most files we serve are images and already compressed.

However, there are some cases where large files may be highly compressible (e.g., huge XML files stored in LFS) and we can benefit from compressing responses.

Make a reasonable guess about whether compression is beneficial and enable compression if we guess it is.

Test Plan
  • Used curl ... to download an image with Accept-Encoding: gzip. Got raw image data in the response (as expected, because we don't expect images to be worthwhile to recompress).
  • Used curl ... to download a text file with Accept-Encoding: gzip. Got a compressed response. Decompressed the response into the original file.

Diff Detail

Repository
rP Phabricator
Branch
compress1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 24127
Build 33221: Run Core Tests
Build 33220: arc lint + arc unit

Event Timeline

This revision was not accepted when it landed; it landed in state Needs Review.Apr 15 2020, 6:53 PM
This revision was automatically updated to reflect the committed changes.