/** * Display the HTTP auth form for username and password * @param IResponse $response */ public function sendAuthRequest(IResponse $response) { $response->setStatus(IHttpStatus::HTTP_UNAUTHORIZED); $response->addHeader('WWW-Authenticate', 'Basic realm="Please provide your username and password"'); $response->flush(); exit; }
public function execute(IRequest $request, IResponse $response) { $view = new HtmlTemplateView(__APP_PATH . 'views/default.php'); if ($request->issetParameter('name')) { $view->assign('name', $request->getParameter('name')); } $response->write($view->parse()); }
/** * @param IResponse $Response * @param resource $connection * @return bool */ protected function getResponseBody(IResponse $Response, $connection) { if (stripos($Response->getHeader('transfer-encoding'), 'chunked') !== false) { $body = $this->getChunkedResponse($connection); } else { $read_size = intval($Response->getHeader('Content-Length')); if ($read_size <= 0) { if ($this->Connection->isKeepAlive()) { return ''; } $read_size = -1; } $body = $this->stream_get_contents($connection, $read_size); } if ($body === false) { $this->Connection->close(); return false; } if (!empty($body) && stripos($Response->getHeader('content-encoding'), 'gzip') !== false) { $body = $this->getUnzippedBody($body); } return $body; }