Changeset View
Changeset View
Standalone View
Standalone View
src/future/http/BaseHTTPFuture.php
Context not available. | |||||
* @task config | * @task config | ||||
*/ | */ | ||||
public function getHeaders($filter = null) { | public function getHeaders($filter = null) { | ||||
$filter = strtolower($filter); | $filter = @strtolower($filter); | ||||
$result = array(); | $result = array(); | ||||
foreach ($this->headers as $header) { | foreach ($this->headers as $header) { | ||||
list($name, $value) = $header; | list($name, $value) = $header; | ||||
if (!$filter || ($filter == strtolower($name))) { | if (!$filter || ($filter == @strtolower($name))) { | ||||
$result[] = $header; | $result[] = $header; | ||||
} | } | ||||
} | } | ||||
Context not available. | |||||
$data = $this->getData(); | $data = $this->getData(); | ||||
if (is_scalar($data)) { | if (is_scalar($data)) { | ||||
return strlen($data); | return @strlen($data); | ||||
} | } | ||||
return strlen(phutil_build_http_querystring($data)); | return @strlen(phutil_build_http_querystring($data)); | ||||
} | } | ||||
public function setDisableContentDecoding($disable_decoding) { | public function setDisableContentDecoding($disable_decoding) { | ||||
Context not available. | |||||
$response = $raw_response; | $response = $raw_response; | ||||
while (true) { | while (true) { | ||||
$matches = null; | $matches = null; | ||||
if (!preg_match($rex_base, $response, $matches)) { | if (!@preg_match($rex_base, $response, $matches)) { | ||||
return $this->buildMalformedResult($raw_response); | return $this->buildMalformedResult($raw_response); | ||||
} | } | ||||
$head = $matches['head']; | $head = $matches['head']; | ||||
$body = $matches['body']; | $body = $matches['body']; | ||||
if (!preg_match($rex_head, $head, $matches)) { | if (!@preg_match($rex_head, $head, $matches)) { | ||||
return $this->buildMalformedResult($raw_response); | return $this->buildMalformedResult($raw_response); | ||||
} | } | ||||
$response_code = (int)$matches['code']; | $response_code = (int)$matches['code']; | ||||
$response_status = strtolower($matches['status']); | $response_status = @strtolower($matches['status']); | ||||
if ($response_code == 100) { | if ($response_code == 100) { | ||||
// This is HTTP/1.X 100 Continue, so this whole chunk is moot. | // This is HTTP/1.X 100 Continue, so this whole chunk is moot. | ||||
$response = $body; | $response = $body; | ||||
Context not available. | |||||
$headers_raw = preg_split("/\r?\n/", $head_raw); | $headers_raw = preg_split("/\r?\n/", $head_raw); | ||||
foreach ($headers_raw as $header) { | foreach ($headers_raw as $header) { | ||||
$m = null; | $m = null; | ||||
if (preg_match($rex_header, $header, $m)) { | if (@preg_match($rex_header, $header, $m)) { | ||||
$headers[] = array($m['name'], $m['value']); | $headers[] = array($m['name'], $m['value']); | ||||
} else { | } else { | ||||
$headers[] = array($header, null); | $headers[] = array($header, null); | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0