<commit_before><?php
namespace General\Hooks;

class GeneralHooks extends \Asgard\Hook\HookContainer {
	/**
	 * @Hook("Asgard.Http.Start")
	 */
	public static function maintenance(\Asgard\Hook\Chain $chain, \Asgard\Http\Request $request) {
		if(file_exists($chain->getContainer()['kernel']['root'].'/storage/maintenance')) {
			$controller = new \General\Controllers\DefaultController;
			$chain->getContainer()['httpKernel']->prepareController($controller, 'maintenance', $request);
			return $controller->run('maintenance', $request);
		}
	}

	/**
	 * @Hook("Asgard.Http.Exception.Asgard\Http\Exceptions\NotFoundException")
	 */
	public static function hook404Exception(\Asgard\Hook\Chain $chain, \Exception $exception, \Asgard\Http\Response &$response, \Asgard\Http\Request $request) {
		$response = $chain->getContainer()['httpKernel']->runController('General\Controllers\DefaultController', '_404', $request)->setCode(404);
	}

	/**
	 * @Hook("Asgard.Http.Output")
	 * @Priority(1000)
	 */
	public static function gzip(\Asgard\Hook\Chain $chain, \Asgard\Http\Response $response, \Asgard\Http\Request $request) {
		if(!strstr($request->server['HTTP_ACCEPT_ENCODING'], 'gzip') || !$response->getContent())
			return;

		$output = gzencode($response->getContent());
		$response
			->setContent($output)
			->setHeader('Content-Encoding', 'gzip')
			->setHeader('Content-Length', strlen($output))
			->setHeader('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate')
			->setHeader('Pragma', 'no-cache');
	}
}<commit_msg>remove gzip compression. should be done through apache/nginx.<commit_after><?php
namespace General\Hooks;

class GeneralHooks extends \Asgard\Hook\HookContainer {
	/**
	 * @Hook("Asgard.Http.Start")
	 */
	public static function maintenance(\Asgard\Hook\Chain $chain, \Asgard\Http\Request $request) {
		if(file_exists($chain->getContainer()['kernel']['root'].'/storage/maintenance')) {
			$controller = new \General\Controllers\DefaultController;
			$chain->getContainer()['httpKernel']->prepareController($controller, 'maintenance', $request);
			return $controller->run('maintenance', $request);
		}
	}

	/**
	 * @Hook("Asgard.Http.Exception.Asgard\Http\Exceptions\NotFoundException")
	 */
	public static function hook404Exception(\Asgard\Hook\Chain $chain, \Exception $exception, \Asgard\Http\Response &$response, \Asgard\Http\Request $request) {
		$response = $chain->getContainer()['httpKernel']->runController('General\Controllers\DefaultController', '_404', $request)->setCode(404);
	}
}
{'fraction_non_alphanumeric': 0.1820340324495449, 'fraction_numerical': 0.009101701622477245, 'mean_word_length': 5.635170603674541, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7130018', 'n_tokens_mistral': 855, 'n_tokens_neox': 767, 'n_words': 119}