Bug #12631 Updated: Fatal: ob_get_length() returns wrong value when compressed OB is on
| From: | yohgaki@php.net | Date: | Wed, 12 Dec 2001 09:37:27 +0000 |
| Subject: | Bug #12631 Updated: Fatal: ob_get_length() returns wrong value when compressed OB is on | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-73242@lists.php.net to get a copy of this message | ||
ID: 12631
Updated by: yohgaki
Reported By: troels@arvin.dk
Old Status: Open
Status: Closed
Bug Type: Output Control
Operating System: Linux
PHP Version: 4.0.6
New Comment:
I might be wrong, but this is fixed in CVS or 4.1.0
Please reopen if problem exists in snapshot.
http://snaps.php.net/
Previous Comments:
------------------------------------------------------------------------
[2001-08-07 14:11:53] troels@arvin.dk
When output buffering is on, using the gzhandler, then ob_get_length() returns the uncompressed
content length in stead of the actual (compressed) payload.
This is fatal if a Content-Length HTTP-header is sent and the browser implements HTTP keep-alive.
The result is a web-site which appears to be down or with extremely slow responses.
Example PHP code:
<?php
ob_start('ob_gzhandler');
print "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; // 30 a's
print "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; // 30 b's
print "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; // 30 a's
header('Content-Length: '.ob_get_length());
ob_end_flush();
?>
If this is saved as http://localhost/ob.php then try the
following wget command:
wget --header="Accept-Encoding: gzip" --header="Connection: close" -S http://localhost/ob.php
Notice that wget displays the following error message continuously:
Connection closed at byte 36. Retrying.
Also notice that the web-server told wget to expect 90 bytes (the uncompressed payload).
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=12631&edit=1