/** * Writes the response to connection. * * @access public * @param HTTPResponse $response * @return void */ public function write(HTTPResponse $response) { $config = $this->dispatcher->get_config(); try { if ($config['VERBOSE'] >= 2) { file_put_contents($config['LOG_FILE'], $response->headers_as_string() . "\r\n", FILE_APPEND); } if ($this->request->write($response)) { $this->close(); } } catch (Exception $e) { if ($config['VERBOSE'] >= 2) { file_put_contents($config['LOG_FILE'], $e->getMessage() . "\r\n", FILE_APPEND); } $this->close(); } if ($config['VERBOSE'] >= 1) { $this->dispatcher->log($this->request, $response); } }