ID: 42362 Updated by: [EMAIL PROTECTED] Reported By: ob dot php at daevel dot net -Status: Open +Status: Feedback Bug Type: HTTP related Operating System: Debian Etch PHP Version: 5.2.3 New Comment:
How is this a bug when you tell in your request that you accept gzipped data? Of course you get that header then. Previous Comments: ------------------------------------------------------------------------ [2007-08-21 15:13:31] ob dot php at daevel dot net I add : there is exactly 26 bytes between the 2 requests : 1f 8b 80 00 00 00 00 00 00 30 20 00 00 00 ff ff 30 00 00 00 00 00 00 00 00 00 So it seems to be the "gzip header". ------------------------------------------------------------------------ [2007-08-21 14:51:30] ob dot php at daevel dot net Description: ------------ Hello, when zlib.output_compression is enabled and the script stop without any contents (case of a 304 page), after all PHP sends contents. So, if the client use keep-alive, the next request could be "corrupted". I use php as an Apache 2 module. I reproduced it under PHP 4.4.X too. Note : if I disable "zlib.output_compression" and use "ob_start( 'gz_handler' )" there is not this problem. Reproduce code: --------------- A minimal 304 page : <?php header( 'Date: '.gmdate('D, d M Y H:i:s').' GMT' ); header( 'Not Modified', true, 304 ); exit; ?> A minimal client simulation : <?php $sk = fsockopen( 'your-domain.tld', 80 ); $headers = array( 'GET /test_304.php HTTP/1.1', 'Host: your-domain.tld', 'Accept-Encoding: gzip,deflate', 'Keep-Alive: 300', 'Connection: keep-alive', 'If-Modified-Since: Tue, 21 Aug 2007 13:00:54 GMT', ); function sock_send( &$sk, $line ) { echo '> ', $line, PHP_EOL; fputs( $sk, $line . "\r\n" ); } function sock_gets( &$sk ) { $line = fgets( $sk, 4096 ); echo '< ', rtrim($line), PHP_EOL; return $line; } for( $i = 1; $i <=2 ; $i++ ) { echo "Sending request ", $i, PHP_EOL; foreach( $headers as $h ) sock_send( $sk, $h ); sock_send( $sk, '' ); echo "Reading headers only (no contents should be send)", PHP_EOL; while( !feof( $sk ) ) { $line = trim(sock_gets( $sk )); if( $line === '' ) { break; } } } fclose( $sk ); ?> Expected result: ---------------- Response headers for the second request should be the same as the first. In my example : < HTTP/1.1 304 Not Modified < Date: Tue, 21 Aug 2007 14:45:40 GMT < Server: Apache/2.2.3 (Debian) PHP/4.4.4-8+etch4 < Connection: Keep-Alive < Keep-Alive: timeout=60, max=100 < Vary: Accept-Encoding Actual result: -------------- Actually there is some "chars" (I suppose the end of compressed data, like checksum ?) < ▼ ♥☻ ♥ HTTP/1.1 304 Not Modified < Date: Tue, 21 Aug 2007 14:45:40 GMT < Server: Apache/2.2.3 (Debian) PHP/4.4.4-8+etch4 < Connection: Keep-Alive < Keep-Alive: timeout=60, max=99 < Vary: Accept-Encoding < ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42362&edit=1