$response = '';
$gotStatus = false;
while (($line = @
fgets($this->socket
)) !== false
) { $gotStatus =
$gotStatus || (strpos($line, 'HTTP'
) !== false
);
if ($gotStatus) { $response .=
$line;
if (rtrim($line) === ''
) break;
} } $this->
_checkSocketReadTimeout();
$statusCode = Zend_Http_Response::
extractCode($response);
// Handle 100 and 101 responses internally by restarting the read again
if ($statusCode == 100 ||
$statusCode == 101
) return $this->
read();
// Check headers to see what kind of connection / transfer encoding we have
$headers = Zend_Http_Response::
extractHeaders($response);
/**
* Responses to HEAD requests and 204 or 304 responses are not expected
* to have a body - stop reading here
*/