mirror of
git://develop.git.wordpress.org/
synced 2025-01-18 05:18:42 +01:00
Check if $_SERVER['HTTP_ACCEPT_ENCODING'] is set before determining whether to compress scripts, props nacin, fixes #11169
git-svn-id: https://develop.svn.wordpress.org/trunk@12214 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
7c3f9cf02b
commit
8066de0726
@ -91,6 +91,8 @@ case 'wp-compression-test' :
|
||||
echo $test_str;
|
||||
die;
|
||||
} elseif ( 2 == $_GET['test'] ) {
|
||||
if ( !isset($_SERVER['HTTP_ACCEPT_ENCODING']) )
|
||||
die('-1');
|
||||
if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
|
||||
header('Content-Encoding: deflate');
|
||||
$out = gzdeflate( $test_str, 1 );
|
||||
|
@ -127,7 +127,7 @@ header('Content-Type: application/x-javascript; charset=UTF-8');
|
||||
header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
|
||||
header("Cache-Control: public, max-age=$expires_offset");
|
||||
|
||||
if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') ) {
|
||||
if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
|
||||
header('Vary: Accept-Encoding'); // Handle proxies
|
||||
if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
|
||||
header('Content-Encoding: deflate');
|
||||
|
@ -137,7 +137,7 @@ header('Content-Type: text/css');
|
||||
header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
|
||||
header("Cache-Control: public, max-age=$expires_offset");
|
||||
|
||||
if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') ) {
|
||||
if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
|
||||
header('Vary: Accept-Encoding'); // Handle proxies
|
||||
if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
|
||||
header('Content-Encoding: deflate');
|
||||
|
@ -1,4 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* Disable error reporting
|
||||
*
|
||||
* Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging
|
||||
*/
|
||||
error_reporting(0);
|
||||
|
||||
$basepath = dirname(__FILE__);
|
||||
|
||||
@ -20,7 +26,9 @@ header('Vary: Accept-Encoding'); // Handle proxies
|
||||
header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
|
||||
header("Cache-Control: public, max-age=$expires_offset");
|
||||
|
||||
if ( isset($_GET['c']) && 1 == $_GET['c'] && false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) {
|
||||
if ( isset($_GET['c']) && 1 == $_GET['c'] && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
|
||||
&& false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) {
|
||||
|
||||
header('Content-Encoding: gzip');
|
||||
echo $file;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user