summaryrefslogtreecommitdiff
path: root/ext/zlib
diff options
context:
space:
mode:
Diffstat (limited to 'ext/zlib')
-rw-r--r--ext/zlib/config.w322
-rw-r--r--ext/zlib/config0.m42
-rw-r--r--ext/zlib/php_zlib.h4
-rw-r--r--ext/zlib/tests/001.phpt2
-rw-r--r--ext/zlib/tests/002.phpt2
-rw-r--r--ext/zlib/tests/gzfilegzreadfile.phpt2
-rw-r--r--ext/zlib/tests/zlib_filter_deflate.phpt2
-rw-r--r--ext/zlib/tests/zlib_filter_deflate2.phpt16
-rw-r--r--ext/zlib/tests/zlib_filter_inflate.phpt2
-rw-r--r--ext/zlib/tests/zlib_filter_inflate2.phpt2
-rw-r--r--ext/zlib/zlib.c15
-rw-r--r--ext/zlib/zlib_filter.c31
-rw-r--r--ext/zlib/zlib_fopen_wrapper.c2
13 files changed, 55 insertions, 29 deletions
diff --git a/ext/zlib/config.w32 b/ext/zlib/config.w32
index 54ee96b02..5e51cfed9 100644
--- a/ext/zlib/config.w32
+++ b/ext/zlib/config.w32
@@ -1,4 +1,4 @@
-// $Id: config.w32,v 1.8.6.2 2008/06/22 21:55:59 pajoye Exp $
+// $Id: config.w32 261512 2008-06-22 21:55:59Z pajoye $
// vim:ft=javascript
ARG_ENABLE("zlib", "ZLIB support", "yes");
diff --git a/ext/zlib/config0.m4 b/ext/zlib/config0.m4
index 0e9f4cd80..e8f57d830 100644
--- a/ext/zlib/config0.m4
+++ b/ext/zlib/config0.m4
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config0.m4,v 1.17.2.1 2005/11/29 18:35:26 tony2001 Exp $
+dnl $Id: config0.m4 201617 2005-11-29 18:35:26Z tony2001 $
dnl
PHP_ARG_WITH(zlib,for ZLIB support,
diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h
index 7470f1a14..a4271324d 100644
--- a/ext/zlib/php_zlib.h
+++ b/ext/zlib/php_zlib.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_zlib.h,v 1.42.2.1.2.2.2.2 2008/12/31 11:15:47 sebastian Exp $ */
+/* $Id: php_zlib.h 286751 2009-08-03 18:15:30Z jani $ */
#ifndef PHP_ZLIB_H
#define PHP_ZLIB_H
@@ -35,6 +35,8 @@ ZEND_BEGIN_MODULE_GLOBALS(zlib)
char *output_handler;
ZEND_END_MODULE_GLOBALS(zlib)
+PHPAPI ZEND_EXTERN_MODULE_GLOBALS(zlib)
+
extern php_stream_filter_factory php_zlib_filter_factory;
extern zend_module_entry php_zlib_module_entry;
#define zlib_module_ptr &php_zlib_module_entry
diff --git a/ext/zlib/tests/001.phpt b/ext/zlib/tests/001.phpt
index c1e679f97..f789c2737 100644
--- a/ext/zlib/tests/001.phpt
+++ b/ext/zlib/tests/001.phpt
@@ -3,7 +3,7 @@ gzdeflate()/gzinflate()
--SKIPIF--
<?php if (!extension_loaded("zlib")) print "skip"; ?>
--FILE--
-<?php /* $Id: 001.phpt,v 1.4 2004/05/19 08:45:23 helly Exp $ */
+<?php /* $Id: 001.phpt 242949 2007-09-26 15:44:16Z cvs2svn $ */
$original = str_repeat("hallo php",4096);
$packed=gzdeflate($original);
echo strlen($packed)." ".strlen($original)."\n";
diff --git a/ext/zlib/tests/002.phpt b/ext/zlib/tests/002.phpt
index 90a599598..b40f1ff36 100644
--- a/ext/zlib/tests/002.phpt
+++ b/ext/zlib/tests/002.phpt
@@ -3,7 +3,7 @@ gzcompress()/gzuncompress()
--SKIPIF--
<?php if (!extension_loaded("zlib")) print "skip"; ?>
--FILE--
-<?php /* $Id: 002.phpt,v 1.3 2004/05/19 08:45:23 helly Exp $ */
+<?php /* $Id: 002.phpt 242949 2007-09-26 15:44:16Z cvs2svn $ */
$original = str_repeat("hallo php",4096);
$packed=gzcompress($original);
echo strlen($packed)." ".strlen($original)."\n";
diff --git a/ext/zlib/tests/gzfilegzreadfile.phpt b/ext/zlib/tests/gzfilegzreadfile.phpt
index 36539b797..a7c2c096a 100644
--- a/ext/zlib/tests/gzfilegzreadfile.phpt
+++ b/ext/zlib/tests/gzfilegzreadfile.phpt
@@ -1,7 +1,7 @@
--TEST--
gzfile(), gzreadfile()
--SKIPIF--
-<?php /* $Id: gzfilegzreadfile.phpt,v 1.2 2004/05/19 08:45:23 helly Exp $ */
+<?php /* $Id: gzfilegzreadfile.phpt 242949 2007-09-26 15:44:16Z cvs2svn $ */
if (!extension_loaded("zlib")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/zlib/tests/zlib_filter_deflate.phpt b/ext/zlib/tests/zlib_filter_deflate.phpt
index 0f1851ec6..c31702048 100644
--- a/ext/zlib/tests/zlib_filter_deflate.phpt
+++ b/ext/zlib/tests/zlib_filter_deflate.phpt
@@ -3,7 +3,7 @@ zlib.deflate (with convert.base64-encode)
--SKIPIF--
<?php if (!extension_loaded("zlib")) print "skip"; ?>
--FILE--
-<?php /* $Id: zlib_filter_deflate.phpt,v 1.1.2.1 2005/11/24 04:37:47 pollita Exp $ */
+<?php /* $Id: zlib_filter_deflate.phpt 201145 2005-11-24 04:37:47Z pollita $ */
$text = 'I am the very model of a modern major general, I\'ve information vegetable, animal, and mineral.';
$fp = fopen('php://stdout', 'w');
diff --git a/ext/zlib/tests/zlib_filter_deflate2.phpt b/ext/zlib/tests/zlib_filter_deflate2.phpt
new file mode 100644
index 000000000..764a7606f
--- /dev/null
+++ b/ext/zlib/tests/zlib_filter_deflate2.phpt
@@ -0,0 +1,16 @@
+--TEST--
+zlib.deflate (with level parameter set)
+--SKIPIF--
+<?php if (!extension_loaded("zlib")) print "skip"; ?>
+--FILE--
+<?php
+$text = 'I am the very model of a modern major general, I\'ve information vegetable, animal, and mineral.';
+
+$fp = fopen('php://stdout', 'w');
+stream_filter_append($fp, 'zlib.deflate', STREAM_FILTER_WRITE, array('level' => 9));
+fwrite($fp, $text);
+fclose($fp);
+
+?>
+--EXPECT--
+A Dѫ΍1MBUv_(EL/aP=Pi ;6fCe4U9;w5 m /
diff --git a/ext/zlib/tests/zlib_filter_inflate.phpt b/ext/zlib/tests/zlib_filter_inflate.phpt
index 0220c85e5..0a5836e3c 100644
--- a/ext/zlib/tests/zlib_filter_inflate.phpt
+++ b/ext/zlib/tests/zlib_filter_inflate.phpt
@@ -3,7 +3,7 @@ zlib.inflate (with convert.base64-decode)
--SKIPIF--
<?php if (!extension_loaded("zlib")) print "skip"; ?>
--FILE--
-<?php /* $Id: zlib_filter_inflate.phpt,v 1.1.2.1 2005/11/24 04:37:47 pollita Exp $ */
+<?php /* $Id: zlib_filter_inflate.phpt 201145 2005-11-24 04:37:47Z pollita $ */
$text = 'HctBDoAgDETRq8zOjfEeHKOGATG0TRpC4u1Vdn/xX4IoxkVMxgP1zA4vkJVhULk9UGkM6TvSNolmxUNlNLePVQ45O3eINf0fsQxtCxwv';
$fp = fopen('php://stdout', 'w');
diff --git a/ext/zlib/tests/zlib_filter_inflate2.phpt b/ext/zlib/tests/zlib_filter_inflate2.phpt
index 9d85bbe84..f8e7a8b80 100644
--- a/ext/zlib/tests/zlib_filter_inflate2.phpt
+++ b/ext/zlib/tests/zlib_filter_inflate2.phpt
@@ -3,7 +3,7 @@ zlib.inflate of gzip-encoded stream
--SKIPIF--
<?php if (!extension_loaded("zlib")) print "skip"; ?>
--FILE--
-<?php /* $Id: zlib_filter_inflate2.phpt,v 1.1.4.2 2008/01/09 06:45:36 cellog Exp $ */
+<?php /* $Id: zlib_filter_inflate2.phpt 250201 2008-01-09 06:45:36Z cellog $ */
$a = gzopen(dirname(__FILE__) . '/test.txt.gz', 'w');
fwrite($a, "This is quite the thing ain't it\n");
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index a21c00d1e..8fe31422b 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zlib.c,v 1.183.2.6.2.5.2.14 2009/05/28 10:15:14 lbarnaud Exp $ */
+/* $Id: zlib.c 287423 2009-08-17 17:30:32Z jani $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1045,6 +1045,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");
}
diff --git a/ext/zlib/zlib_filter.c b/ext/zlib/zlib_filter.c
index fa2c50d6a..45b66a7c9 100644
--- a/ext/zlib/zlib_filter.c
+++ b/ext/zlib/zlib_filter.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zlib_filter.c,v 1.6.2.2.2.4.2.9 2008/12/31 11:15:47 sebastian Exp $ */
+/* $Id: zlib_filter.c 287926 2009-08-31 21:18:55Z jani $ */
#include "php.h"
#include "php_zlib.h"
@@ -352,7 +352,7 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
if (filterparams) {
- zval **tmpzval;
+ zval **tmpzval, tmp;
/* filterparams can either be a scalar value to indicate compression level (shortcut method)
Or can be a hash containing one or more of 'window', 'memory', and/or 'level' members. */
@@ -361,8 +361,6 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
case IS_ARRAY:
case IS_OBJECT:
if (zend_hash_find(HASH_OF(filterparams), "memory", sizeof("memory"), (void**) &tmpzval) == SUCCESS) {
- zval tmp;
-
tmp = **tmpzval;
zval_copy_ctor(&tmp);
convert_to_long(&tmp);
@@ -376,8 +374,6 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
}
if (zend_hash_find(HASH_OF(filterparams), "window", sizeof("window"), (void**) &tmpzval) == SUCCESS) {
- zval tmp;
-
tmp = **tmpzval;
zval_copy_ctor(&tmp);
convert_to_long(&tmp);
@@ -391,6 +387,8 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
}
if (zend_hash_find(HASH_OF(filterparams), "level", sizeof("level"), (void**) &tmpzval) == SUCCESS) {
+ tmp = **tmpzval;
+
/* Psuedo pass through to catch level validating code */
goto factory_setlevel;
}
@@ -398,19 +396,16 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
case IS_STRING:
case IS_DOUBLE:
case IS_LONG:
- {
- zval tmp;
-
- tmp = *filterparams;
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
+ tmp = *filterparams;
factory_setlevel:
- /* Set compression level within reason (-1 == default, 0 == none, 1-9 == least to most compression */
- if (Z_LVAL(tmp) < -1 || Z_LVAL(tmp) > 9) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid compression level specified. (%ld)", Z_LVAL(tmp));
- } else {
- level = Z_LVAL(tmp);
- }
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+
+ /* Set compression level within reason (-1 == default, 0 == none, 1-9 == least to most compression */
+ if (Z_LVAL(tmp) < -1 || Z_LVAL(tmp) > 9) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid compression level specified. (%ld)", Z_LVAL(tmp));
+ } else {
+ level = Z_LVAL(tmp);
}
break;
default:
diff --git a/ext/zlib/zlib_fopen_wrapper.c b/ext/zlib/zlib_fopen_wrapper.c
index e4aa217bd..465637941 100644
--- a/ext/zlib/zlib_fopen_wrapper.c
+++ b/ext/zlib/zlib_fopen_wrapper.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zlib_fopen_wrapper.c,v 1.46.2.1.2.4.2.3 2009/01/20 15:41:23 felipe Exp $ */
+/* $Id: zlib_fopen_wrapper.c 274034 2009-01-20 15:41:23Z felipe $ */
#define _GNU_SOURCE