Damn it! gzip_output() was not checking for gzip support in the browser, fixed.
authorDan
Fri, 11 Sep 2009 09:55:24 -0400
changeset 1110 1a3f374310ca
parent 1109 c424a15a1656
child 1112 679916c80599
Damn it! gzip_output() was not checking for gzip support in the browser, fixed.
includes/functions.php
--- a/includes/functions.php	Fri Sep 11 09:54:32 2009 -0400
+++ b/includes/functions.php	Fri Sep 11 09:55:24 2009 -0400
@@ -3157,11 +3157,18 @@
 {
   global $do_gzip;
   
+  $gzip_supported = false;
+  if ( isset($_SERVER['HTTP_ACCEPT_ENCODING']) )
+  {
+    $encodings = explode(',', $_SERVER['HTTP_ACCEPT_ENCODING']);
+    $gzip_supported = in_array('gzip', $encodings) || in_array('deflate', $encodings);
+  }
+  
   //
   // Compress buffered output if required and send to browser
   // Sorry, doesn't work in IE. What else is new?
   //
-  if ( $do_gzip && function_exists('gzdeflate') && !strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE') && !headers_sent() )
+  if ( $do_gzip && function_exists('gzdeflate') && !strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE') && !headers_sent() && $gzip_supported )
   {
     $gzip_contents = ob_get_contents();
     ob_end_clean();