diff options
author | Zeev Suraski <zeev@php.net> | 2000-11-13 18:54:37 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 2000-11-13 18:54:37 +0000 |
commit | 0f7f5c2c0e616445d14b49641e85dbddcc1651e5 (patch) | |
tree | 83f0bce3ba6ba891798d828e5ad1c0334739513e /main | |
parent | 9b42296babc97defd3b7635b395506d5539aae20 (diff) | |
download | php-git-0f7f5c2c0e616445d14b49641e85dbddcc1651e5.tar.gz |
- Import Jade Nicoletti's transparent gzip encoding support as an output
handler. Works quite nicely!
- Fix buglets in output buffering
- Add output_handler INI directive
Diffstat (limited to 'main')
-rw-r--r-- | main/SAPI.c | 5 | ||||
-rw-r--r-- | main/SAPI.h | 3 | ||||
-rw-r--r-- | main/main.c | 15 | ||||
-rw-r--r-- | main/php_globals.h | 3 |
4 files changed, 20 insertions, 6 deletions
diff --git a/main/SAPI.c b/main/SAPI.c index 563f1cd072..67bd8019de 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -271,6 +271,7 @@ SAPI_API void sapi_activate(SLS_D) SG(request_info).post_data = NULL; SG(request_info).current_user = NULL; SG(request_info).current_user_length = 0; + SG(request_info).no_headers = 0; /* It's possible to override this general case in the activate() callback, if * necessary. @@ -363,7 +364,7 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo char *colon_offset; SLS_FETCH(); - if (SG(headers_sent)) { + if (SG(headers_sent) && !SG(request_info).no_headers) { char *output_start_filename = php_get_output_start_filename(); int output_start_lineno = php_get_output_start_lineno(); @@ -457,7 +458,7 @@ SAPI_API int sapi_send_headers() int ret = FAILURE; SLS_FETCH(); - if (SG(headers_sent)) { + if (SG(headers_sent) || SG(request_info).no_headers) { return SUCCESS; } diff --git a/main/SAPI.h b/main/SAPI.h index 86eb356104..9c2f06abe3 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -73,7 +73,8 @@ typedef struct { const char *content_type; - unsigned char headers_only; + zend_bool headers_only; + zend_bool no_headers; sapi_post_entry *post_entry; diff --git a/main/main.c b/main/main.c index 2ef64e9af1..325a9802b5 100644 --- a/main/main.c +++ b/main/main.c @@ -223,6 +223,7 @@ PHP_INI_BEGIN() STD_PHP_INI_BOOLEAN("magic_quotes_runtime", "0", PHP_INI_ALL, OnUpdateBool, magic_quotes_runtime, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("magic_quotes_sybase", "0", PHP_INI_ALL, OnUpdateBool, magic_quotes_sybase, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("output_buffering", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateBool, output_buffering, php_core_globals, core_globals) + STD_PHP_INI_ENTRY("output_handler", NULL, PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateString, output_handler, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("register_argc_argv", "1", PHP_INI_ALL, OnUpdateBool, register_argc_argv, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("register_globals", "1", PHP_INI_ALL, OnUpdateBool, register_globals, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("safe_mode", "0", PHP_INI_SYSTEM, OnUpdateBool, safe_mode, php_core_globals, core_globals) @@ -623,7 +624,15 @@ int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC) sapi_add_header(SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1, 1); } - if (PG(output_buffering)) { + if (PG(output_handler)) { + zval *output_handler; + + ALLOC_INIT_ZVAL(output_handler); + Z_STRLEN_P(output_handler) = strlen(PG(output_handler)); /* this can be optimized */ + Z_STRVAL_P(output_handler) = estrndup(PG(output_handler), Z_STRLEN_P(output_handler)); + Z_TYPE_P(output_handler) = IS_STRING; + php_start_ob_buffer(output_handler); + } else if (PG(output_buffering)) { php_start_ob_buffer(NULL); } else if (PG(implicit_flush)) { php_start_implicit_flush(); @@ -656,11 +665,11 @@ void php_request_shutdown(void *dummy) PLS_FETCH(); if (setjmp(EG(bailout))==0) { - sapi_send_headers(); + php_end_ob_buffers(SG(request_info).headers_only?0:1); } if (setjmp(EG(bailout))==0) { - php_end_ob_buffers(SG(request_info).headers_only?0:1); + sapi_send_headers(); } if (PG(modules_activated) && setjmp(EG(bailout))==0) { diff --git a/main/php_globals.h b/main/php_globals.h index 97461c1e0a..aa313a4075 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -65,6 +65,9 @@ struct _php_core_globals { zend_bool safe_mode; zend_bool sql_safe_mode; zend_bool enable_dl; + + char *output_handler; + char *safe_mode_exec_dir; long memory_limit; |