cvs: php4 /ext/zlib zlib.c

From: Date: Sat, 27 Apr 2002 17:03:53 +0000
Subject: cvs: php4 /ext/zlib zlib.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-11478@lists.php.net to get a copy of this message
thies Sat Apr 27 13:03:53 2002 EDT Modified files: /php4/ext/zlib zlib.c Log: @ - If possible set Content-Length header in zlib.output_compression mode. (thies) Index: php4/ext/zlib/zlib.c diff -u php4/ext/zlib/zlib.c:1.129 php4/ext/zlib/zlib.c:1.130 --- php4/ext/zlib/zlib.c:1.129 Fri Apr 19 06:06:41 2002 +++ php4/ext/zlib/zlib.c Sat Apr 27 13:03:32 2002 @@ -18,7 +18,7 @@ | Jade Nicoletti <nicoletti@nns.ch> | +----------------------------------------------------------------------+ */ -/* $Id: zlib.c,v 1.129 2002/04/19 10:06:41 wez Exp $ */ +/* $Id: zlib.c,v 1.130 2002/04/27 17:03:32 thies Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -955,6 +955,13 @@ do_end = (mode & PHP_OUTPUT_HANDLER_END ? 1 : 0); if (php_deflate_string(output, output_len, handled_output, handled_output_len, ZLIBG(ob_gzip_coding), do_start, do_end, ZLIBG(output_compression_level) TSRMLS_CC)!=SUCCESS) { zend_error(E_ERROR, "Compression failed"); + } else { + if (do_start && do_end) { + char lenbuf[64]; + + sprintf(lenbuf,"Content-Length: %d", *handled_output_len); + sapi_add_header(lenbuf,strlen(lenbuf), 1); + } } } /* }}} */ @@ -984,7 +991,7 @@ } else { return FAILURE; } - + php_start_ob_buffer(NULL, buffer_size, 0 TSRMLS_CC); php_ob_set_internal_handler(php_gzip_output_handler, buffer_size*1.5, "zlib output compression", 0 TSRMLS_CC); return SUCCESS;

« previous php.cvs (#11478) next »