public function processResponse(Horde_Controller_Request $request, Horde_Controller_Response $response, Horde_Controller $controller) { $body = $response->getBody(); $body = gzencode($body); $response->setHeader('Content-Encoding', 'gzip'); $response->setHeader('Content-Length', $this->_byteCount($body)); $response->setBody($body); return $response; }
/** */ public function writeResponse(Horde_Controller_Response $response) { foreach ($response->getHeaders() as $key => $value) { header("{$key}: {$value}"); } $body = $response->getBody(); if (is_resource($body)) { stream_copy_to_stream($body, fopen('php://output', 'a')); } else { echo $body; } }
public function writeResponse(Horde_Controller_Response $response) { $headerHtml = '<div><strong>Headers:</strong><pre>'; $headers = $response->getHeaders(); foreach ($headers as $key => $value) { $headerHtml .= htmlspecialchars("{$key}: {$value}\n"); } echo $headerHtml . '</pre></div>'; if (isset($headers['Location'])) { echo '<p>Redirect To: <a href="' . htmlspecialchars($headers['Location']) . '">' . htmlspecialchars($headers['Location']) . '</a></p>'; } $body = $response->getBody(); if (is_resource($body)) { $body = stream_get_contents($body); } if (isset($headers['Content-Encoding']) && $headers['Content-Encoding'] == 'gzip') { // Strip off the header and inflate it echo gzinflate(substr($body, 10)); } else { echo $body; } }