#45234 [Opn->Fbk]: Incorrect Content-Length header
| From: | jani@php.net | Date: | Thu, 23 Oct 2008 12:29:04 +0000 |
| Subject: | #45234 [Opn->Fbk]: Incorrect Content-Length header | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-130002@lists.php.net to get a copy of this message | ||
ID: 45234
Updated by: jani@php.net
Reported By: kulakov74 at yandex dot ru
-Status: Open
+Status: Feedback
Bug Type: Zlib Related
Operating System: Linux
PHP Version: 5.2CVS-2008-06-11 (snap)
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Previous Comments:
------------------------------------------------------------------------
[2008-06-11 11:03:49] kulakov74 at yandex dot ru
Description:
------------
Many pointed out to the problem that the Content-Length header may have
incorrect value when using zlib.output_compression. This problem may
have been fixed but not completely. When the compressed data fits within
8K Content-Length is sent by zlib after compression and hence the header
(if present) is updated correctly, but when the compressed data is
larger no Content-Length is sent by zlib and hence the value is not
fixed. 8K is the default buffer size for zlib (mod_deflate) and is not
configurable. Anyway, whatever the size of the buffer is, I think the
initial Content-Length should be removed when zlib cannot determine the
size of the compressed data in advance.
The following bugs are related:
http://bugs.php.net/bug.php?id=28460
http://bugs.php.net/bug.php?id=22143
http://bugs.php.net/bug.php?id=24083
I guess many pages compress to more than 8K.
Reproduce code:
---------------
$FileToSend="filename.txt";
header("Content-Length: ".filesize($FileToSend));
readfile($FileToSend);
Expected result:
----------------
Content-Length header with the right value or removed.
Actual result:
--------------
Content-Length header with the same value I set. Note that the file
that is sent should COMPRESS to more than 8K in order for this to show.
It may be 25K and the problem will not show up.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45234&edit=1