Page MenuHomePhabricator

Don't combine automatic output compression with "Content-Length"
ClosedPublic

Authored by epriestley on Dec 13 2016, 10:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 16, 6:20 PM
Unknown Object (File)
Sat, Dec 14, 5:53 PM
Unknown Object (File)
Mon, Dec 9, 6:12 AM
Unknown Object (File)
Tue, Dec 3, 8:55 PM
Unknown Object (File)
Nov 17 2024, 7:37 PM
Unknown Object (File)
Nov 16 2024, 8:49 PM
Unknown Object (File)
Nov 13 2024, 5:33 PM
Unknown Object (File)
Nov 12 2024, 10:34 PM
Subscribers

Details

Summary

Fixes T12013. Send either "Content-Length" or enable output compression, but not both.

Prefer compression for static resources (CSS, JS, etc).

Test Plan

Ran curl -v ..., no longer saw responses with both compression and Content-Length.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Don't combine automatic output compression with "Content-Length".
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
avivey added inline comments.
src/aphront/response/AphrontFileResponse.php
134–136

maybe also enable the compression on else?

Yeahhhhh

src/aphront/response/AphrontFileResponse.php
134–136

It's enabled globally in PhabricatorStartup and I shudder to think what PHP might do if we enable it twice.

It would, perhaps, be cleaner to bring the CompressResponse stuff up a level to AphrontResponse, and have that control zlib.output_compression in all cases, although when we fatal the "¯\_(ツ)_/¯" page won't get compressed.

  • Centralize compression logic in one place, in AphrontResponse.
avivey added a reviewer: avivey.

Yeah, that looks like it will probably not PHP in new ways?

("PHP" in that sentence is short for "break in interesting ways").

This revision is now accepted and ready to land.Dec 13 2016, 10:23 PM

Hahaha. Yeah, this feels a little more solid.

This revision was automatically updated to reflect the committed changes.