Commit 8412e1a5 authored by ruloweb's avatar ruloweb Committed by bgm

Issue #1416214 gzip support

parent 35adff9f
......@@ -204,8 +204,8 @@ function boost_admin_htaccess_generate_htaccess() {
foreach ($enabled_file_extensions as $extension => $values) {
$type = $values['content_type'];
if ($values['gzip']) {
$output['gzip'] .= " RewriteCond $document_root$base_path$cache_dir/%{ENV:boostpath}/$server_name%{REQUEST_URI}$char%{QUERY_STRING}\.$extension -s\n";
$output['gzip'] .= " RewriteRule .* $cache_dir/%{ENV:boostpath}/$server_name%{REQUEST_URI}$char%{QUERY_STRING}\.$extension [L,T=$type,E=no-gzip:1]\n";
$output['gzip'] .= " RewriteCond $document_root$base_path$cache_dir/%{ENV:boostpath}/$server_name%{REQUEST_URI}$char%{QUERY_STRING}\.$extension\.gz -s\n";
$output['gzip'] .= " RewriteRule .* $cache_dir/%{ENV:boostpath}/$server_name%{REQUEST_URI}$char%{QUERY_STRING}\.$extension\.gz [L,T=$type,E=no-gzip:1]\n";
$gzip_count++;
}
$output['normal'] .= " RewriteCond $document_root$base_path$cache_dir/%{ENV:boostpath}/$server_name%{REQUEST_URI}$char%{QUERY_STRING}\.$extension -s\n";
......
......@@ -308,6 +308,11 @@ function boost_exit($destination = NULL) {
$_boost['filename'] .= '.' . $_boost['matched_header_info']['extension'];
// Write to file.
boost_write_file($_boost['filename'], $data);
// Gzip support.
if (function_exists('gzencode')) {
boost_write_file($_boost['filename'] . '.gz', gzencode($data, 9));
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment