From 5a671a6fc70f1a0a333b8369e03499828cc96db8 Mon Sep 17 00:00:00 2001 From: rurban Date: Sun, 18 Sep 2005 15:15:53 +0000 Subject: [PATCH] add a proper Content-Encoding: gzip if compressed, and omit Content-Length then. git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@4863 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/IniConfig.php | 9 +++++++-- lib/Request.php | 14 ++++++++++++-- lib/prepend.php | 4 ++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/lib/IniConfig.php b/lib/IniConfig.php index 6d33b827f..04fc1d285 100644 --- a/lib/IniConfig.php +++ b/lib/IniConfig.php @@ -1,5 +1,5 @@ _is_compressing_output = true; + header("Content-Encoding: gzip"); /* * Attempt to prevent Apache from doing the dreaded double-gzip. * @@ -382,6 +386,7 @@ class Request { // at any point. // FIXME: change the name of this method. ob_start(); + $this->_is_compressing_output = false; } $this->_is_buffering_output = true; $this->_ob_get_length = 0; @@ -441,7 +446,9 @@ class Request { echo $html; } else { */ - if (!headers_sent()) { + // if _is_compressing_output then ob_get_length() returns + // the uncompressed length, not the gzip'ed as required. + if (!headers_sent() and ! $this->_is_compressing_output) { if (empty($this->_do_chunked_output)) { $this->_ob_get_length = ob_get_length(); } @@ -1336,6 +1343,9 @@ class HTTP_ValidatorSet { // $Log: not supported by cvs2svn $ +// Revision 1.97 2005/09/14 05:58:17 rurban +// protect against Content-Length if headers_sent(), fixed writing unwanted accesslog sql entries +// // Revision 1.96 2005/08/07 10:52:43 rurban // stricter error handling: dba errors are fatal, display errors on Request->finish or session_close // diff --git a/lib/prepend.php b/lib/prepend.php index e79b112bd..2923c4f03 100644 --- a/lib/prepend.php +++ b/lib/prepend.php @@ -9,10 +9,10 @@ function rcs_id ($id) { if (defined('DEBUG') and DEBUG) $GLOBALS['RCS_IDS'] .= "$id\n"; } -rcs_id('$Id: prepend.php,v 1.43 2005-09-14 06:06:43 rurban Exp $'); +rcs_id('$Id: prepend.php,v 1.44 2005-09-18 15:15:53 rurban Exp $'); // see lib/stdlib.php: phpwiki_version() -define('PHPWIKI_VERSION', '1.3.11p1'); +define('PHPWIKI_VERSION', '1.3.12pre-20050918'); /** * Returns true if current php version is at mimimum a.b.c -- 2.45.0