Re: Re: Output Compression Issues
| From: | Zeev Suraski | Date: | Thu, 16 Aug 2001 12:26:09 +0000 |
| Subject: | Re: Re: Output Compression Issues | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-63422@lists.php.net to get a copy of this message | ||
At 14:55 16-08-01, Troels Arvin wrote:
On Thu, 16 Aug 2001 07:44:50 +0200, "John Donagher" <john@webmeta.com> wrote: So, we really want to disable output compression when we are serving anything but HTML/text. I agree on that. I have heard that some older versions of both major browsers have trouble with compressed non-HTML content. - Or perhaps the ob_gzhandler could be given an argument telling it to be conservative or not? - Oh, and please: Could someone take a look at this bug which I really think is serious: http://www.php.net/bugs.php?id=12631 As written, it's currently not possible to send proper Content-Length headers along with gz-encoded PHP-output because it's not possible to get the correct output-length information when using the gzhandler. When Content-Lengh headers are not sent, then Apache is not capable of using keep-alive == worse performance. There are lines like this in zlib.c: #if 0The output buffering system knows how many bytes were returned, but it doesn't really matter, as all it does with the returned bytes, is print them out (the output buffering system itself is not programmable). So, to summarize: - Output compression should probably check that the content type is text/*, and not perform compression otherwise - We can look into sending the content length header from the output compression callback Can anybody think of good reasons not to send the content-length header in case we're performing output buffering? Zeev} else { char lenbuf[64];sprintf(lenbuf,"Content-Length: %d",Z_STRLEN_P(return_value)); sapi_add_header(lenbuf,strlen(lenbuf), 1);#endif What does "#if 0" actually mean? If it's too hard to change the output buffering system to return proper content lengths, maybe it would be an idea to be able to tell ob_end_flush() that you want a Content-Length header to be sent along? (It seems that ob_gzhandler knows the correct Content-Length but is unable to pass that information along to the output buffering system.)