/usr/share/php/Horde/Controller/Filter/Gzip.php is in php-horde-controller 2.0.1-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | <?php
/**
* Filter to gzip content before being served
*
* @category Horde
* @package Controller
* @author James Pepin <james@bluestatedigital.com>
* @license http://www.horde.org/licenses/bsd BSD
*/
class Horde_Controller_Filter_Gzip implements Horde_Controller_PostFilter
{
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;
}
/**
* If mbstring is set to overload str* function then we could be counting
* multi-byte chars as single bytes so we need to treat the string like its
* 8-bit encoded to get an accurate byte count.
*/
protected function _byteCount($string)
{
if (ini_get('mbstring.func_overload') > 0) {
return mb_strlen($string, '8bit');
}
return strlen($string);
}
}
|