* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class Sender implements SenderInterface { /** * The chunk size which is used if the transfer encoding is "chunked" * * @param integer $chunkSize * @deprecated */ public function setChunkSize($chunkSize) { } /** * @inheritdoc */ public function send(ResponseInterface $response) { // remove body on specific status codes if (in_array($response->getStatusCode(), array(100, 101, 204, 304))) { $response->setBody(new StringStream('')); } // if we have a location header we dont send any content elseif ($response->hasHeader('Location')) { $response->setBody(new StringStream('')); } if ($this->shouldSendHeader()) { // send status line $this->sendStatusLine($response); // send headers $this->sendHeaders($response); } // send body $this->sendBody($response); } protected function shouldSendHeader() { return PHP_SAPI != 'cli' && !headers_sent(); } protected function sendStatusLine(ResponseInterface $response) { $scheme = $response->getProtocolVersion(); if (empty($scheme)) { $scheme = 'HTTP/1.1'; } $code = $response->getStatusCode(); if (!isset(Http::$codes[$code])) { $code = 200; } $this->sendHeader($scheme . ' ' . $code . ' ' . Http::$codes[$code]); } protected function sendHeaders(ResponseInterface $response) { $headers = ResponseParser::buildHeaderFromMessage($response); foreach ($headers as $header) { $this->sendHeader($header); } } protected function sendHeader($header) { header($header); } protected function sendBody(ResponseInterface $response) { $body = $response->getBody(); if ($body instanceof StreamInterface) { echo $body->__toString(); } } } __halt_compiler();----SIGNATURE:----eJbZQHb+V0lNCDagVTwxHemwYLKEOzCNoSR8WI8EPIeTzr/h1QlEmzHsoaI5Ohlr5qgvfWQjB03AirX7wzymsUeCsWF8DUSZgBEfP7hFzjYFdWW7RNuMcV5UlTdoEkcdRvbv5PJZTjogYRoZ7lKc74zVl1KMQ5h9cSTqeeWy/7wioM4FPqfr3IQmbN2Rkp2Hne1GFitWDf/OyinOW2wIshJ0GWXUQFz3XELeMmkcseEbTQ2ffZiIMj1TNB+ETbTxUi84U93ElDsUQ8PW7N0SRZqrAGVhaIP+Qsr89dMByAcArwzE9q6K5gZzD6omh3QHBlDUBUPUwWaRxIRbvr//W0pBs7Z2VLpIQ34Fh/hDUecOUtYr6Q4qKeS7CXsMjmCUV11GGM2KrP/OBUxSDZ/Ua+p4rnBj13gvwj4gZx0JMvuMybXMjtdzAPlPIasj236TBwOTMmjE947vqytnLfMB5GHmlVKYH2/xZTvG3qXzpWSXkojtIzVmPQVCnY80UjdnVHfXWaqybCW+wwsadSBtDwxJUh/slDEx66wpNftwQLgPMFcaAAe2FBdYp7AdZSWqD/3aGa1K/IklBUM2ZzA1ZN7yLyHf6ExkqRWvC6h5iVh3rF79llRK86VBRVJWSWeOeAWOeW9Gru4rheOT7pp3kggQgDKf22Gcck1UH+BWtfw=----ATTACHMENT:----OTg1Mzg4MjE3MzcwMDQ1NCA1Nzc4NzY2MDIxNDA3MDY0IDQ1MzE2NDM3Njg4MDgwNA==