Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15335037
D21120.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D21120.diff
View Options
diff --git a/src/aphront/requeststream/AphrontRequestStream.php b/src/aphront/requeststream/AphrontRequestStream.php
--- a/src/aphront/requeststream/AphrontRequestStream.php
+++ b/src/aphront/requeststream/AphrontRequestStream.php
@@ -101,8 +101,9 @@
$filters = stream_get_filters();
foreach ($filters as $filter) {
- if (preg_match('/^zlib\\./', $filter)) {
+ if (!strncasecmp($filter, 'zlib.', strlen('zlib.'))) {
$has_zlib = true;
+ break;
}
}
diff --git a/src/aphront/response/AphrontJSONResponse.php b/src/aphront/response/AphrontJSONResponse.php
--- a/src/aphront/response/AphrontJSONResponse.php
+++ b/src/aphront/response/AphrontJSONResponse.php
@@ -31,10 +31,10 @@
}
public function getHeaders() {
- $headers = array(
- array('Content-Type', 'application/json'),
- );
- $headers = array_merge(parent::getHeaders(), $headers);
+ $headers = parent::getHeaders();
+
+ $headers[] = array('Content-Type', 'application/json');
+
return $headers;
}
diff --git a/src/aphront/response/AphrontResponse.php b/src/aphront/response/AphrontResponse.php
--- a/src/aphront/response/AphrontResponse.php
+++ b/src/aphront/response/AphrontResponse.php
@@ -10,7 +10,7 @@
private $contentSecurityPolicyURIs;
private $disableContentSecurityPolicy;
protected $frameable;
-
+ private $headers = array();
public function setRequest($request) {
$this->request = $request;
@@ -49,6 +49,11 @@
return $this;
}
+ final public function addHeader($key, $value) {
+ $this->headers[] = array($key, $value);
+ return $this;
+ }
+
/* -( Content )------------------------------------------------------------ */
@@ -105,6 +110,10 @@
$headers[] = array('Referrer-Policy', 'no-referrer');
+ foreach ($this->headers as $header) {
+ $headers[] = $header;
+ }
+
return $headers;
}
diff --git a/src/applications/conduit/controller/PhabricatorConduitAPIController.php b/src/applications/conduit/controller/PhabricatorConduitAPIController.php
--- a/src/applications/conduit/controller/PhabricatorConduitAPIController.php
+++ b/src/applications/conduit/controller/PhabricatorConduitAPIController.php
@@ -134,9 +134,17 @@
$method_implementation);
case 'json':
default:
- return id(new AphrontJSONResponse())
+ $response = id(new AphrontJSONResponse())
->setAddJSONShield(false)
->setContent($response->toDictionary());
+
+ $capabilities = $this->getConduitCapabilities();
+ if ($capabilities) {
+ $capabilities = implode(' ', $capabilities);
+ $response->addHeader('X-Conduit-Capabilities', $capabilities);
+ }
+
+ return $response;
}
}
@@ -716,5 +724,14 @@
return false;
}
+ private function getConduitCapabilities() {
+ $capabilities = array();
+
+ if (AphrontRequestStream::supportsGzip()) {
+ $capabilities[] = 'gzip';
+ }
+
+ return $capabilities;
+ }
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 9, 1:51 PM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7389110
Default Alt Text
D21120.diff (2 KB)
Attached To
Mode
D21120: In Conduit responses, assert that Phabricator supports a "gzip" capability
Attached
Detach File
Event Timeline
Log In to Comment