Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15310729
D21121.id50300.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
D21121.id50300.diff
View Options
diff --git a/src/future/http/BaseHTTPFuture.php b/src/future/http/BaseHTTPFuture.php
--- a/src/future/http/BaseHTTPFuture.php
+++ b/src/future/http/BaseHTTPFuture.php
@@ -26,7 +26,7 @@
private $uri;
private $data;
private $expect;
-
+ private $disableContentDecoding;
/* -( Creating a New Request )--------------------------------------------- */
@@ -276,6 +276,15 @@
return strlen(phutil_build_http_querystring($data));
}
+ public function setDisableContentDecoding($disable_decoding) {
+ $this->disableContentDecoding = $disable_decoding;
+ return $this;
+ }
+
+ public function getDisableContentDecoding() {
+ return $this->disableContentDecoding;
+ }
+
/* -( Resolving the Request )---------------------------------------------- */
@@ -348,24 +357,26 @@
}
}
- $content_encoding = null;
- foreach ($headers as $header) {
- list($name, $value) = $header;
- $name = phutil_utf8_strtolower($name);
- if (!strcasecmp($name, 'Content-Encoding')) {
- $content_encoding = $value;
- break;
+ if (!$this->getDisableContentDecoding()) {
+ $content_encoding = null;
+ foreach ($headers as $header) {
+ list($name, $value) = $header;
+ $name = phutil_utf8_strtolower($name);
+ if (!strcasecmp($name, 'Content-Encoding')) {
+ $content_encoding = $value;
+ break;
+ }
}
- }
- switch ($content_encoding) {
- case 'gzip':
- $decoded_body = gzdecode($body);
- if ($decoded_body === false) {
- return $this->buildMalformedResult($raw_response);
- }
- $body = $decoded_body;
- break;
+ switch ($content_encoding) {
+ case 'gzip':
+ $decoded_body = @gzdecode($body);
+ if ($decoded_body === false) {
+ return $this->buildMalformedResult($raw_response);
+ }
+ $body = $decoded_body;
+ break;
+ }
}
$status = new HTTPFutureHTTPResponseStatus(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 7, 9:24 AM (2 w, 18 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7228183
Default Alt Text
D21121.id50300.diff (1 KB)
Attached To
Mode
D21121: Allow HTTPFuture callers to disable processing of "Content-Encoding" response headers
Attached
Detach File
Event Timeline
Log In to Comment