Changeset View
Changeset View
Standalone View
Standalone View
src/future/http/HTTPFuture.php
Context not available. | |||||
} | } | ||||
public function getWriteSockets() { | public function getWriteSockets() { | ||||
if (strlen($this->writeBuffer)) { | if (@strlen($this->writeBuffer)) { | ||||
return array($this->socket); | return array($this->socket); | ||||
} | } | ||||
return array(); | return array(); | ||||
Context not available. | |||||
} | } | ||||
if ($this->stateConnected) { | if ($this->stateConnected) { | ||||
if (strlen($this->writeBuffer)) { | if (@strlen($this->writeBuffer)) { | ||||
$bytes = @fwrite($this->socket, $this->writeBuffer); | $bytes = @fwrite($this->socket, $this->writeBuffer); | ||||
if ($bytes === false) { | if ($bytes === false) { | ||||
throw new Exception(pht('Failed to write to buffer.')); | throw new Exception(pht('Failed to write to buffer.')); | ||||
} else if ($bytes) { | } else if ($bytes) { | ||||
$this->writeBuffer = substr($this->writeBuffer, $bytes); | $this->writeBuffer = @substr($this->writeBuffer, $bytes); | ||||
} | } | ||||
} | } | ||||
if (!strlen($this->writeBuffer)) { | if (!@strlen($this->writeBuffer)) { | ||||
$this->stateWriteComplete = true; | $this->stateWriteComplete = true; | ||||
} | } | ||||
while (($data = fread($this->socket, 32768)) || strlen($data)) { | while (($data = fread($this->socket, 32768)) || @strlen($data)) { | ||||
$this->response .= $data; | $this->response .= $data; | ||||
} | } | ||||
Context not available. | |||||
if ($this->getMethod() == 'GET') { | if ($this->getMethod() == 'GET') { | ||||
if (is_array($data)) { | if (is_array($data)) { | ||||
$data = phutil_build_http_querystring($data); | $data = phutil_build_http_querystring($data); | ||||
if (strpos($uri, '?') !== false) { | if (@strpos($uri, '?') !== false) { | ||||
$uri .= '&'.$data; | $uri .= '&'.$data; | ||||
} else { | } else { | ||||
$uri .= '?'.$data; | $uri .= '?'.$data; | ||||
Context not available. | |||||
} | } | ||||
} | } | ||||
$length = strlen($data); | $length = @strlen($data); | ||||
$add_headers[] = array( | $add_headers[] = array( | ||||
'Content-Length', | 'Content-Length', | ||||
Context not available. | |||||
$headers = array_merge($this->getHeaders(), $add_headers); | $headers = array_merge($this->getHeaders(), $add_headers); | ||||
foreach ($headers as $key => $header) { | foreach ($headers as $key => $header) { | ||||
list($name, $value) = $header; | list($name, $value) = $header; | ||||
if (strlen($value)) { | if (@strlen($value)) { | ||||
$value = ': '.$value; | $value = ': '.$value; | ||||
} | } | ||||
$headers[$key] = $name.$value."\r\n"; | $headers[$key] = $name.$value."\r\n"; | ||||
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