PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTTP » HTTP_Download » Bug #3960

Allow zlib.output_compression in php.ini

Details

Request #3960Allow zlib.output_compression in php.ini
Submitted2005-03-25 16:07 UTC
Frombrian at onlineinfo dot net
Assignedmike
StatusClosed
PackageHTTP_Download
PHP Version4.3.10
Roadmaps(Not assigned)

Comments

[2005-03-25 16:07 UTC] brian at onlineinfo dot net

Description:
------------
I was using HTTP_Download 0.5.1 and it was working fine with zlib.output_compression set in php.ini. After upgrade to 1.0.0 scripts get stuck in an endless loop because of the following condition: set_time_limit(0) is called and ob_get_level() seems to always returns 1 with zlib.output_compression enabled. It would be very nice to be able to use the latest-and-greatest version without having to modify the server configuration.

Reproduce code:
---------------
Here is a patch that is makes it work. I have tested this patch with Firefox/linux, Konqueror/linux, and Internet Explorer 6/windows 2000.

--- /usr/local/lib/php/HTTP/Download.php 2005-03-25 09:55:28.000000000 -0500
+++ pear/HTTP/Download.php 2005-03-25 10:49:32.000000000 -0500
@@ -651,9 +651,7 @@
unset($this->headers['Last-Modified']);
}

- while (ob_get_level()) {
- ob_end_clean();
- }
+ while (@ob_end_clean());

if ($this->gzip) {
@ob_start('ob_gzhandler');
@@ -668,7 +666,12 @@
$this->HTTP->sendStatusCode(200);
$chunks = array(array(0, $this->size));
if (!$this->gzip) {
- $this->headers['Content-Length'] = $this->size;
+ // if only using default output handler set the
+ // Content-Length header. Otherwise assume the
+ // output handler will set the Content-Length header
+ if (!array_key_exists(1, ob_list_handlers())) {
+ $this->headers['Content-Length'] = $this->size;
+ }
}
}