mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-12-23 05:50:54 +01:00
Compress requests from the Conduit client to Phabricator
Summary: Ref T13507. Enable compression in the body of Conduit requests if we have client support for it; we expect the server should always support it. Test Plan: Created this revision, ran random "arc" commands that use Conduit. Added debugging code, saw payload size drop. Maniphest Tasks: T13507 Differential Revision: https://secure.phabricator.com/D21073
This commit is contained in:
parent
deb72c37db
commit
7e25288f49
1 changed files with 14 additions and 1 deletions
|
@ -143,12 +143,25 @@ final class ConduitClient extends Phobject {
|
|||
|
||||
// Always use the cURL-based HTTPSFuture, for proxy support and other
|
||||
// protocol edge cases that HTTPFuture does not support.
|
||||
$core_future = new HTTPSFuture($uri, $data);
|
||||
$core_future = new HTTPSFuture($uri);
|
||||
$core_future->addHeader('Host', $this->getHostStringForHeader());
|
||||
|
||||
$core_future->setMethod('POST');
|
||||
$core_future->setTimeout($this->timeout);
|
||||
|
||||
// See T13507. If possible, try to compress requests. We always expect
|
||||
// Phabricator to be able to accept "Content-Encoding: gzip" requests.
|
||||
$can_gzip = function_exists('gzencode');
|
||||
if ($can_gzip) {
|
||||
$gzip_data = phutil_build_http_querystring($data);
|
||||
$gzip_data = gzencode($gzip_data);
|
||||
|
||||
$core_future->addHeader('Content-Encoding', 'gzip');
|
||||
$core_future->setData($gzip_data);
|
||||
} else {
|
||||
$core_future->setData($data);
|
||||
}
|
||||
|
||||
if ($this->username !== null) {
|
||||
$core_future->setHTTPBasicAuthCredentials(
|
||||
$this->username,
|
||||
|
|
Loading…
Reference in a new issue