Changeset View
Changeset View
Standalone View
Standalone View
src/future/http/BaseHTTPFuture.php
| Show First 20 Lines • Show All 342 Lines • ▼ Show 20 Lines | while (true) { | ||||
| // then the normal response. Drop this chunk. | // then the normal response. Drop this chunk. | ||||
| $response = $body; | $response = $body; | ||||
| } else { | } else { | ||||
| $headers = $this->parseHeaders(idx($matches, 'headers')); | $headers = $this->parseHeaders(idx($matches, 'headers')); | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| $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; | |||||
| } | |||||
| $status = new HTTPFutureHTTPResponseStatus( | $status = new HTTPFutureHTTPResponseStatus( | ||||
| $response_code, | $response_code, | ||||
| $body, | $body, | ||||
| $headers, | $headers, | ||||
| $this->expect); | $this->expect); | ||||
| return array($status, $body, $headers); | return array($status, $body, $headers); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines | |||||