Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43083 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54293 invoked from network); 17 Feb 2009 22:14:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Feb 2009 22:14:53 -0000 Authentication-Results: pb1.pair.com header.from=news@ger.gmane.org; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=php-php-dev@m.gmane.org; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain m.gmane.org designates 80.91.229.2 as permitted sender) X-PHP-List-Original-Sender: php-php-dev@m.gmane.org X-Host-Fingerprint: 80.91.229.2 main.gmane.org Linux 2.5 (sometimes 2.4) (4) Received: from [80.91.229.2] ([80.91.229.2:33086] helo=ciao.gmane.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FF/DC-36931-BD63B994 for ; Tue, 17 Feb 2009 17:14:52 -0500 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LZYDJ-0000uI-Uk for internals@lists.php.net; Tue, 17 Feb 2009 22:14:49 +0000 Received: from lily.mit.edu ([18.243.2.157]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 17 Feb 2009 22:14:49 +0000 Received: from edwardzyang by lily.mit.edu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 17 Feb 2009 22:14:49 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: internals@lists.php.net Date: Tue, 17 Feb 2009 17:14:40 -0500 Lines: 25 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: lily.mit.edu User-Agent: Thunderbird 2.0.0.19 (X11/20090105) In-Reply-To: Sender: news Subject: Re: [PHP-DEV] Don't compress empty output with zlib From: edwardzyang@thewritingpot.com ("Edward Z. Yang") Edward Z. Yang wrote: > Hello all, I've cooked up a short paonetch for Bug 42362, and would > appreciate comments. The patch turns off zlib compression if there is no > output, to make zlib_compression play more nicely with 304s. The previous patch is wrong (it doesn't handle the flush();flush(); case well). Here's a better one, although it's 304 specific: Index: ext/zlib/zlib.c =================================================================== RCS file: /repository/php-src/ext/zlib/zlib.c,v retrieving revision 1.183.2.6.2.8 diff -u -r1.183.2.6.2.8 zlib.c --- ext/zlib/zlib.c 31 Dec 2008 11:17:47 -0000 1.183.2.6.2.8 +++ ext/zlib/zlib.c 17 Feb 2009 22:13:40 -0000 @@ -979,7 +979,7 @@ { zend_bool do_start, do_end; - if (!ZLIBG(output_compression)) { + if (!ZLIBG(output_compression) || SG(sapi_headers).http_response_code == 304) { *handled_output = NULL; } else { do_start = (mode & PHP_OUTPUT_HANDLER_START ? 1 : 0);