1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 02:02:41 +01:00

(stable) Decode "Content-Encoding: gzip" content

Summary:
Fixes T10228. When we receive a gzipped request (rare, but `git` may send them), decode it before providing it to the application.

This fixes the issue with proxying certain requests described in T10228.

Test Plan:
  - Applied this fix in production.
  - Cloned a problem repository cleanly.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10228

Differential Revision: https://secure.phabricator.com/D15145
This commit is contained in:
epriestley 2016-01-30 16:44:33 -08:00
parent 482da7f5df
commit 71bda66870

View file

@ -129,7 +129,19 @@ final class PhabricatorStartup {
self::beginOutputCapture();
self::$rawInput = (string)file_get_contents('php://input');
if (isset($_SERVER['HTTP_CONTENT_ENCODING'])) {
$encoding = trim($_SERVER['HTTP_CONTENT_ENCODING']);
} else {
$encoding = null;
}
if ($encoding === 'gzip') {
$source_stream = 'compress.zlib://php://input';
} else {
$source_stream = 'php://input';
}
self::$rawInput = (string)file_get_contents($source_stream);
}