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
F14825733: D17045.id40997.diff
Tue, Jan 28, 10:49 PM
Unknown Object (File)
Mon, Jan 27, 10:16 AM
Unknown Object (File)
Sun, Jan 26, 6:11 PM
Unknown Object (File)
Fri, Jan 24, 6:31 PM
Unknown Object (File)
Fri, Jan 24, 6:31 PM
Unknown Object (File)
Tue, Jan 21, 4:55 PM
Unknown Object (File)
Tue, Jan 21, 9:16 AM
Unknown Object (File)
Sat, Jan 18, 4:53 AM
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
Branch
compress1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 14886
Build 19496: Run Core Tests
Build 19495: arc lint + arc unit

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.