Hannes Magnusson wrote: > 2009/3/24 Scott MacVicar <scott...@php.net>: >> scottmac Tue Mar 24 01:57:54 2009 UTC >> >> Modified files: (Branch: PHP_5_3) >> /php-src/ext/zlib zlib.c >> Log: >> Fix bug #42362 - certain status codes never have output, so sending the >> gzip compression headers cause problems >> >> >> >> http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib.c?r1=1.183.2.6.2.5.2.9&r2=1.183.2.6.2.5.2.10&diff_format=u >> Index: php-src/ext/zlib/zlib.c >> diff -u php-src/ext/zlib/zlib.c:1.183.2.6.2.5.2.9 >> php-src/ext/zlib/zlib.c:1.183.2.6.2.5.2.10 >> --- php-src/ext/zlib/zlib.c:1.183.2.6.2.5.2.9 Wed Dec 31 11:15:47 2008 >> +++ php-src/ext/zlib/zlib.c Tue Mar 24 01:57:53 2009 >> @@ -19,7 +19,7 @@ >> +----------------------------------------------------------------------+ >> */ >> >> -/* $Id: zlib.c,v 1.183.2.6.2.5.2.9 2008/12/31 11:15:47 sebastian Exp $ */ >> +/* $Id: zlib.c,v 1.183.2.6.2.5.2.10 2009/03/24 01:57:53 scottmac Exp $ */ >> >> #ifdef HAVE_CONFIG_H >> #include "config.h" >> @@ -1034,7 +1034,7 @@ >> { >> zend_bool do_start, do_end; >> >> - if (!ZLIBG(output_compression)) { >> + if (!ZLIBG(output_compression) || >> SG(sapi_headers).http_response_code == 204 || >> SG(sapi_headers).http_response_code == 304) { >> *handled_output = NULL; > > What happens with: > <?php > header("HTTP/1.1 200 OK"); > exit; > ?> > or <?php > header("Location: http://www.example.com/"); > exit; > ?> > ? > > This looks more like treating the symptoms rather then fixing the problem.. > > -Hannes
204 and 304 can *never* have a body sent with them, its fine for all the other status codes to have empty compessed output. There is no simple fix for this because a flush() can occur with zero output, this doesn't mean avoid gzipping. It's just nothing has been sent to that point. This is probably fixed in HEAD with the new output stuff though. Scott -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php