diff options
Diffstat (limited to 'main/SAPI.c')
-rw-r--r-- | main/SAPI.c | 42 |
1 files changed, 5 insertions, 37 deletions
diff --git a/main/SAPI.c b/main/SAPI.c index f13bab533..a4a8ed787 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: SAPI.c,v 1.202.2.7.2.15.2.7 2009/04/28 21:30:23 stas Exp $ */ +/* $Id: SAPI.c 287423 2009-08-17 17:30:32Z jani $ */ #include <ctype.h> #include <sys/stat.h> @@ -32,9 +32,6 @@ #if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE) #include "ext/pcre/php_pcre.h" #endif -#if HAVE_ZLIB -#include "ext/zlib/php_zlib.h" -#endif #ifdef ZTS #include "TSRM.h" #endif @@ -637,11 +634,12 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) ptr++; len--; } -#if HAVE_ZLIB - if(!strncmp(ptr, "image/", sizeof("image/")-1)) { + + /* Disable possible output compression for images */ + if (!strncmp(ptr, "image/", sizeof("image/")-1)) { zend_alter_ini_entry("zlib.output_compression", sizeof("zlib.output_compression"), "0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); } -#endif + mimetype = estrdup(ptr); newlen = sapi_apply_default_charset(&mimetype, len TSRMLS_CC); if (!SG(sapi_headers).mimetype){ @@ -789,36 +787,6 @@ SAPI_API int sapi_send_headers(TSRMLS_D) return SUCCESS; } -#if HAVE_ZLIB - /* Add output compression headers at this late stage in order to make - it possible to switch it off inside the script. */ - - if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0)) { - zval nm_zlib_get_coding_type; - zval *uf_result = NULL; - - ZVAL_STRINGL(&nm_zlib_get_coding_type, "zlib_get_coding_type", sizeof("zlib_get_coding_type") - 1, 0); - - if (call_user_function_ex(CG(function_table), NULL, &nm_zlib_get_coding_type, &uf_result, 0, NULL, 1, NULL TSRMLS_CC) != FAILURE && uf_result != NULL && Z_TYPE_P(uf_result) == IS_STRING) { - char buf[128]; - int len; - - assert(Z_STRVAL_P(uf_result) != NULL); - - len = slprintf(buf, sizeof(buf), "Content-Encoding: %s", Z_STRVAL_P(uf_result)); - if (len <= 0 || sapi_add_header(buf, len, 1) == FAILURE) { - return FAILURE; - } - if (sapi_add_header_ex("Vary: Accept-Encoding", sizeof("Vary: Accept-Encoding") - 1, 1, 0 TSRMLS_CC) == FAILURE) { - return FAILURE; - } - } - if (uf_result != NULL) { - zval_ptr_dtor(&uf_result); - } - } -#endif - /* Success-oriented. We set headers_sent to 1 here to avoid an infinite loop * in case of an error situation. */ |