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
F14942335: D21125.id.diff
Sat, Feb 15, 5:52 PM
Unknown Object (File)
Fri, Feb 14, 2:52 PM
Unknown Object (File)
Thu, Feb 13, 2:06 AM
Unknown Object (File)
Thu, Feb 13, 12:41 AM
Unknown Object (File)
Wed, Feb 12, 11:56 PM
Unknown Object (File)
Wed, Feb 12, 10:29 PM
Unknown Object (File)
Wed, Feb 12, 9:57 PM
Unknown Object (File)
Sun, Feb 9, 8:59 AM
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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.