From:             kulakov74 at yandex dot ru
Operating system: Linux
PHP version:      5.2CVS-2008-06-11 (snap)
PHP Bug Type:     Zlib Related
Bug description:  Incorrect Content-Length header

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 bug report at http://bugs.php.net/?id=45234&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45234&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45234&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45234&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45234&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45234&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45234&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45234&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45234&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45234&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45234&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45234&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45234&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45234&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45234&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45234&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45234&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45234&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45234&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45234&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45234&r=mysqlcfg

Reply via email to