Re: svn: /php/php-src/branches/ PHP_5_2/ext/zlib/zlib.c PHP_5_3/ext/zlib/zlib.c

From: Date: Sun, 15 Nov 2009 00:38:16 +0000
Subject: Re: svn: /php/php-src/branches/ PHP_5_2/ext/zlib/zlib.c PHP_5_3/ext/zlib/zlib.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-60918@lists.php.net to get a copy of this message
The remaining problem is that this causes flush() to disable compression under Apache due to the buggy output buffering code in 5.* branches. I have no idea how to fix that issue other than merging the new (working) output buffering code (by Mike, iirc) to 5.* branches.. --Jani Jani Taskinen wrote:
jani                                     Sun, 15 Nov 2009 00:13:19 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=290765 Log: - Temporary hack to fix bug #49816 (works fine in HEAD which has working output buffering..) Bug: http://bugs.php.net/49816 (Assigned) output corruption using flush
      Changed paths:
    U   php/php-src/branches/PHP_5_2/ext/zlib/zlib.c
    U   php/php-src/branches/PHP_5_3/ext/zlib/zlib.c
Modified: php/php-src/branches/PHP_5_2/ext/zlib/zlib.c =================================================================== --- php/php-src/branches/PHP_5_2/ext/zlib/zlib.c 2009-11-14 23:29:50 UTC (rev 290764) +++ php/php-src/branches/PHP_5_2/ext/zlib/zlib.c 2009-11-15 00:13:19 UTC (rev 290765) @@ -994,16 +994,23 @@ do_start = (mode & PHP_OUTPUT_HANDLER_START ? 1 : 0); do_end = (mode & PHP_OUTPUT_HANDLER_END ? 1 : 0); - if (do_start && !SG(headers_sent) && !SG(request_info).no_headers) { - switch (ZLIBG(compression_coding)) { - case CODING_GZIP: - sapi_add_header_ex(ZEND_STRL("Content-Encoding: gzip"), 1, 1 TSRMLS_CC); - break; - case CODING_DEFLATE: - sapi_add_header_ex(ZEND_STRL("Content-Encoding: deflate"), 1, 1 TSRMLS_CC); - break; + if (do_start) { + if (!SG(headers_sent) && !SG(request_info).no_headers) { + switch (ZLIBG(compression_coding)) { + case CODING_GZIP: + sapi_add_header_ex(ZEND_STRL("Content-Encoding: gzip"), 1, 1 TSRMLS_CC); + break; + case CODING_DEFLATE: + sapi_add_header_ex(ZEND_STRL("Content-Encoding: deflate"), 1, 1 TSRMLS_CC); + break; + } + sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 1 TSRMLS_CC); + } else { + /* Disable compression if headers can not be set (Fix for bug #49816) */ + ZLIBG(output_compression) = 0; + *handled_output = NULL; + return; } - sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 1 TSRMLS_CC); } if (php_deflate_string(output, output_len, handled_output, handled_output_len, do_start, do_end TSRMLS_CC) != SUCCESS) { Modified: php/php-src/branches/PHP_5_3/ext/zlib/zlib.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/zlib/zlib.c 2009-11-14 23:29:50 UTC (rev 290764) +++ php/php-src/branches/PHP_5_3/ext/zlib/zlib.c 2009-11-15 00:13:19 UTC (rev 290765) @@ -1046,16 +1046,23 @@ do_start = (mode & PHP_OUTPUT_HANDLER_START ? 1 : 0); do_end = (mode & PHP_OUTPUT_HANDLER_END ? 1 : 0); - if (do_start && !SG(headers_sent) && !SG(request_info).no_headers) { - switch (ZLIBG(compression_coding)) { - case CODING_GZIP: - sapi_add_header_ex(ZEND_STRL("Content-Encoding: gzip"), 1, 1 TSRMLS_CC); - break; - case CODING_DEFLATE: - sapi_add_header_ex(ZEND_STRL("Content-Encoding: deflate"), 1, 1 TSRMLS_CC); - break; + if (do_start) { + if (!SG(headers_sent) && !SG(request_info).no_headers) { + switch (ZLIBG(compression_coding)) { + case CODING_GZIP: + sapi_add_header_ex(ZEND_STRL("Content-Encoding: gzip"), 1, 1 TSRMLS_CC); + break; + case CODING_DEFLATE: + sapi_add_header_ex(ZEND_STRL("Content-Encoding: deflate"), 1, 1 TSRMLS_CC); + break; + } + sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 1 TSRMLS_CC); + } else { + /* Disable compression if headers can not be set (Fix for bug #49816) */ + ZLIBG(output_compression) = 0; + *handled_output = NULL; + return; } - sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 1 TSRMLS_CC); } if (php_deflate_string(output, output_len, handled_output, handled_output_len, do_start, do_end TSRMLS_CC) != SUCCESS) {


« previous php.cvs (#60918) next »