|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-06-11 11:03 UTC] 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. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 21 08:00:01 2025 UTC |
I'm very sorry, I cannot go into the trouble of installing PHP, all I could was check the bug with PHP 5.2.6 where it still was found. phpinfo() output this: This is not the latest release definitely. The test script I used was this: <? ob_start(); phpinfo(); $Html=substr(ob_get_clean(), 0, 240000); header("Content-Length: ".strlen($Html)); echo($Html); ?> If the number 240000 is changed to 24000 the header is fine (changed from 24000 to some 5K value), and if it not the header is not correct (remains 240000).