Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14037409
D15314.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D15314.diff
View Options
diff --git a/support/PhabricatorStartup.php b/support/PhabricatorStartup.php
--- a/support/PhabricatorStartup.php
+++ b/support/PhabricatorStartup.php
@@ -135,13 +135,40 @@
$encoding = null;
}
+ $input_stream = fopen('php://input', 'rb');
+ if (!$input_stream) {
+ self::didFatal(
+ 'Unable to open "php://input" to read HTTP request body.');
+ }
+
if ($encoding === 'gzip') {
- $source_stream = 'compress.zlib://php://input';
- } else {
- $source_stream = 'php://input';
+ $ok = stream_filter_append(
+ $input_stream,
+ 'zlib.inflate',
+ STREAM_FILTER_READ,
+ array(
+ 'window' => 30,
+ ));
+
+ if (!$ok) {
+ self::didFatal(
+ 'Failed to append gzip inflate filter to HTTP request body input '.
+ 'stream.');
+ }
+ }
+
+ $input_data = '';
+ while (!feof($input_stream)) {
+ $read_bytes = fread($input_stream, 16 * 1024);
+ if ($read_bytes === false) {
+ self::didFatal(
+ 'Failed to read input bytes from HTTP request body.');
+ }
+ $input_data .= $read_bytes;
}
+ fclose($input_stream);
- self::$rawInput = (string)file_get_contents($source_stream);
+ self::$rawInput = $input_data;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 11, 3:43 PM (6 d, 19 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6740666
Default Alt Text
D15314.diff (1 KB)
Attached To
Mode
D15314: Fix HTTP body decompression in PHP 5.6
Attached
Detach File
Event Timeline
Log In to Comment