diff options
author | Thies C. Arntzen <thies@php.net> | 2002-04-27 17:03:32 +0000 |
---|---|---|
committer | Thies C. Arntzen <thies@php.net> | 2002-04-27 17:03:32 +0000 |
commit | 7b59a131b6e75deeb88ea35bbac372d6d87b9c87 (patch) | |
tree | f28b12dfbb7fad6d546a4dce4914f102a48c6587 /ext/zlib/zlib.c | |
parent | da9dd9acc9de20061b7f96ea42810be29d15c90a (diff) | |
download | php-git-7b59a131b6e75deeb88ea35bbac372d6d87b9c87.tar.gz |
@ - If possible set Content-Length header in zlib.output_compression mode. (thies)
Diffstat (limited to 'ext/zlib/zlib.c')
-rw-r--r-- | ext/zlib/zlib.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index fbfd5820e3..bbc8672ec0 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -955,6 +955,13 @@ static void php_gzip_output_handler(char *output, uint output_len, char **handle 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 @@ int php_enable_output_compression(int buffer_size TSRMLS_DC) } 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; |