diff options
| author | Jani Taskinen <jani@php.net> | 2009-08-17 17:30:32 +0000 |
|---|---|---|
| committer | Jani Taskinen <jani@php.net> | 2009-08-17 17:30:32 +0000 |
| commit | b589d821768cfe3685cbe0b33452710b8c5685cf (patch) | |
| tree | c71f150ff29b306fcbea0c3d3f4d0eb1a8271ee3 /ext/zlib/zlib.c | |
| parent | d6439e0920eb8ef4b470968b288586369e4541bd (diff) | |
| download | php-git-b589d821768cfe3685cbe0b33452710b8c5685cf.tar.gz | |
- Fixed bug #49248 by fixing bug #48994 properly
Diffstat (limited to 'ext/zlib/zlib.c')
| -rw-r--r-- | ext/zlib/zlib.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 8110053a93..0c3eba9476 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -993,6 +993,19 @@ static void php_gzip_output_handler(char *output, uint output_len, char **handle } else { 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; + } + 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) { zend_error(E_ERROR, "Compression failed"); } |
