diff options
Diffstat (limited to 'sapi')
44 files changed, 183 insertions, 165 deletions
diff --git a/sapi/aolserver/aolserver.c b/sapi/aolserver/aolserver.c index 2cb8048af..7cc8cdd65 100644 --- a/sapi/aolserver/aolserver.c +++ b/sapi/aolserver/aolserver.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -22,7 +22,7 @@ * - CGI/1.1 conformance */ -/* $Id: aolserver.c 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: aolserver.c 293036 2010-01-03 09:23:27Z sebastian $ */ /* conflict between PHP and AOLserver headers */ #define Debug php_Debug @@ -205,7 +205,7 @@ static void php_info_aolserver(ZEND_MODULE_INFO_FUNC_ARGS) int i; php_info_print_table_start(); - php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c 272370 2008-12-31 11:15:49Z sebastian $"); + php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c 293036 2010-01-03 09:23:27Z sebastian $"); php_info_print_table_row(2, "Build date", Ns_InfoBuildDate()); php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile()); php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog()); @@ -245,7 +245,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_aolserver_getallheaders, 0) ZEND_END_ARG_INFO() /* }}} */ -const static zend_function_entry aolserver_functions[] = { +static const zend_function_entry aolserver_functions[] = { PHP_FE(getallheaders, arginfo_aolserver_getallheaders) {NULL, NULL, NULL} }; diff --git a/sapi/apache/libpre.c b/sapi/apache/libpre.c index 2fc8c2ac4..ea11f9f70 100644 --- a/sapi/apache/libpre.c +++ b/sapi/apache/libpre.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: libpre.c 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: libpre.c 293036 2010-01-03 09:23:27Z sebastian $ */ #ifdef NETWARE diff --git a/sapi/apache/mod_php5.c b/sapi/apache/mod_php5.c index ce0f81967..68b2d70cc 100644 --- a/sapi/apache/mod_php5.c +++ b/sapi/apache/mod_php5.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ | PHP 4.0 patches by Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: mod_php5.c 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: mod_php5.c 294572 2010-02-05 19:34:47Z pajoye $ */ #include "php_apache_http.h" #include "http_conf_globals.h" @@ -196,6 +196,8 @@ static int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_head if (!strcasecmp(header_name, "Content-Type")) { r->content_type = pstrdup(r->pool, header_content); + } else if (!strcasecmp(header_name, "Content-Length")) { + ap_set_content_length(r, strtol(header_content, (char **)NULL, 10)); } else if (!strcasecmp(header_name, "Set-Cookie")) { table_add(r->headers_out, header_name, header_content); } else if (op == SAPI_HEADER_REPLACE) { diff --git a/sapi/apache/mod_php5.h b/sapi/apache/mod_php5.h index 7f7c159e1..adbb7831b 100644 --- a/sapi/apache/mod_php5.h +++ b/sapi/apache/mod_php5.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -15,7 +15,7 @@ | Author: Rasmus Lerdorf <rasmus@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: mod_php5.h 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: mod_php5.h 293036 2010-01-03 09:23:27Z sebastian $ */ #ifndef MOD_PHP5_H #define MOD_PHP5_H diff --git a/sapi/apache/php_apache.c b/sapi/apache/php_apache.c index 09e8a6519..e323bfb4a 100644 --- a/sapi/apache/php_apache.c +++ b/sapi/apache/php_apache.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ | David Sklar <sklar@student.net> | +----------------------------------------------------------------------+ */ -/* $Id: php_apache.c 272840 2009-01-05 16:24:26Z iliaa $ */ +/* $Id: php_apache.c 293036 2010-01-03 09:23:27Z sebastian $ */ #include "php_apache_http.h" diff --git a/sapi/apache/php_apache_http.h b/sapi/apache/php_apache_http.h index 936484a15..44d09275f 100644 --- a/sapi/apache/php_apache_http.h +++ b/sapi/apache/php_apache_http.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_apache_http.h 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: php_apache_http.h 293036 2010-01-03 09:23:27Z sebastian $ */ #define NO_REGEX_EXTRA_H diff --git a/sapi/apache/sapi_apache.c b/sapi/apache/sapi_apache.c index dce6e5bcc..c2d97a5b4 100644 --- a/sapi/apache/sapi_apache.c +++ b/sapi/apache/sapi_apache.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -19,7 +19,7 @@ | Stig Bakken <ssb@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: sapi_apache.c 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: sapi_apache.c 293036 2010-01-03 09:23:27Z sebastian $ */ #include "php_apache_http.h" diff --git a/sapi/apache2filter/apache_config.c b/sapi/apache2filter/apache_config.c index e06b16856..b9626cb62 100644 --- a/sapi/apache2filter/apache_config.c +++ b/sapi/apache2filter/apache_config.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: apache_config.c 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: apache_config.c 293036 2010-01-03 09:23:27Z sebastian $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS diff --git a/sapi/apache2filter/php_apache.h b/sapi/apache2filter/php_apache.h index 3f54fa714..6ec8c3767 100644 --- a/sapi/apache2filter/php_apache.h +++ b/sapi/apache2filter/php_apache.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_apache.h 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: php_apache.h 293036 2010-01-03 09:23:27Z sebastian $ */ #ifndef PHP_APACHE_H #define PHP_APACHE_H diff --git a/sapi/apache2filter/php_functions.c b/sapi/apache2filter/php_functions.c index d0b662f6c..159e5c5c8 100644 --- a/sapi/apache2filter/php_functions.c +++ b/sapi/apache2filter/php_functions.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_functions.c 272840 2009-01-05 16:24:26Z iliaa $ */ +/* $Id: php_functions.c 293036 2010-01-03 09:23:27Z sebastian $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c index 22f368edd..0c6c274f3 100644 --- a/sapi/apache2filter/sapi_apache2.c +++ b/sapi/apache2filter/sapi_apache2.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sapi_apache2.c 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: sapi_apache2.c 294572 2010-02-05 19:34:47Z pajoye $ */ #include <fcntl.h> @@ -127,6 +127,8 @@ php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_header_op_e if (!strcasecmp(sapi_header->header, "content-type")) ctx->r->content_type = apr_pstrdup(ctx->r->pool, val); + else if (!strcasecmp(sapi_header->header, "content-length")) + ap_set_content_length(ctx->r, strtol(val, (char **)NULL, 10)); else if (op == SAPI_HEADER_REPLACE) apr_table_set(ctx->r->headers_out, sapi_header->header, val); else diff --git a/sapi/apache2handler/apache_config.c b/sapi/apache2handler/apache_config.c index 8057050e4..15e25b5fa 100644 --- a/sapi/apache2handler/apache_config.c +++ b/sapi/apache2handler/apache_config.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: apache_config.c 272413 2008-12-31 14:45:14Z bjori $ */ +/* $Id: apache_config.c 293036 2010-01-03 09:23:27Z sebastian $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS diff --git a/sapi/apache2handler/mod_php5.c b/sapi/apache2handler/mod_php5.c index 038a7122a..56ec28b2f 100644 --- a/sapi/apache2handler/mod_php5.c +++ b/sapi/apache2handler/mod_php5.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mod_php5.c 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: mod_php5.c 293036 2010-01-03 09:23:27Z sebastian $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h index 8573967a9..a7ad1cc86 100644 --- a/sapi/apache2handler/php_apache.h +++ b/sapi/apache2handler/php_apache.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_apache.h 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: php_apache.h 293036 2010-01-03 09:23:27Z sebastian $ */ #ifndef PHP_APACHE_H #define PHP_APACHE_H diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c index 87bed1113..8f8dd3446 100644 --- a/sapi/apache2handler/php_functions.c +++ b/sapi/apache2handler/php_functions.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_functions.c 273971 2009-01-19 19:32:40Z scottmac $ */ +/* $Id: php_functions.c 293036 2010-01-03 09:23:27Z sebastian $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index 62504af42..d54ce4bd3 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sapi_apache2.c 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: sapi_apache2.c 294572 2010-02-05 19:34:47Z pajoye $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -109,7 +109,7 @@ php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_header_op_e ptr = val; *val = '\0'; - + do { val++; } while (*val == ' '); @@ -119,6 +119,8 @@ php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_header_op_e efree(ctx->content_type); } ctx->content_type = estrdup(val); + } else if (!strcasecmp(sapi_header->header, "content-length")) { + ap_set_content_length(ctx->r, strtol(val, (char **)NULL, 10)); } else if (op == SAPI_HEADER_REPLACE) { apr_table_set(ctx->r->headers_out, sapi_header->header, val); } else { @@ -151,8 +153,8 @@ php_apache_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) apr_table_set(ctx->r->subprocess_env, "force-response-1.0", "true"); } } - - /* call ap_set_content_type only once, else each time we call it, + + /* call ap_set_content_type only once, else each time we call it, configured output filters for that content type will be added */ if (!ctx->content_type) { ctx->content_type = sapi_get_default_content_type(TSRMLS_C); @@ -192,7 +194,7 @@ php_apache_sapi_read_post(char *buf, uint count_bytes TSRMLS_DC) buf += len; len = count_bytes - tlen; } - + return tlen; } @@ -238,7 +240,11 @@ php_apache_sapi_getenv(char *name, size_t name_len TSRMLS_DC) { php_struct *ctx = SG(server_context); const char *env_var; - + + if (ctx == NULL) { + return NULL; + } + env_var = apr_table_get(ctx->r->subprocess_env, name); return (char *) env_var; @@ -316,7 +322,8 @@ static void php_apache_sapi_log_message_ex(char *msg, request_rec *r) } } -static time_t php_apache_sapi_get_request_time(TSRMLS_D) { +static time_t php_apache_sapi_get_request_time(TSRMLS_D) +{ php_struct *ctx = SG(server_context); return apr_time_sec(ctx->r->request_time); } @@ -500,12 +507,12 @@ typedef struct { uint str_len; php_conf_rec *c = ap_get_module_config(r->per_dir_config, &php5_module); - for (zend_hash_internal_pointer_reset(&c->config); - zend_hash_get_current_key_ex(&c->config, &str, &str_len, NULL, 0, NULL) == HASH_KEY_IS_STRING; - zend_hash_move_forward(&c->config) + for (zend_hash_internal_pointer_reset(&c->config); + zend_hash_get_current_key_ex(&c->config, &str, &str_len, NULL, 0, NULL) == HASH_KEY_IS_STRING; + zend_hash_move_forward(&c->config) ) { zend_restore_ini_entry(str, str_len, ZEND_INI_STAGE_SHUTDOWN); - } + } } if (p) { ((php_struct *)SG(server_context))->r = p; @@ -555,7 +562,7 @@ normal: } /* Give a 404 if PATH_INFO is used but is explicitly disabled in - * the configuration; default behaviour is to accept. */ + * the configuration; default behaviour is to accept. */ if (r->used_path_info == AP_REQ_REJECT_PATH_INFO && r->path_info && r->path_info[0]) { PHPAP_INI_OFF; @@ -603,17 +610,17 @@ zend_first_try { if (!parent_req) { parent_req = ctx->r; } - if (parent_req && parent_req->handler && - strcmp(parent_req->handler, PHP_MAGIC_TYPE) && - strcmp(parent_req->handler, PHP_SOURCE_MAGIC_TYPE) && + if (parent_req && parent_req->handler && + strcmp(parent_req->handler, PHP_MAGIC_TYPE) && + strcmp(parent_req->handler, PHP_SOURCE_MAGIC_TYPE) && strcmp(parent_req->handler, PHP_SCRIPT)) { if (php_apache_request_ctor(r, ctx TSRMLS_CC)!=SUCCESS) { zend_bailout(); } } - - /* - * check if comming due to ErrorDocument + + /* + * check if comming due to ErrorDocument * We make a special exception of 413 (Invalid POST request) as the invalidity of the request occurs * during processing of the request by PHP during POST processing. Therefor we need to re-use the exiting * PHP instance to handle the request rather then creating a new one. diff --git a/sapi/apache_hooks/mod_php5.c b/sapi/apache_hooks/mod_php5.c index 53d38ec91..03ded2294 100644 --- a/sapi/apache_hooks/mod_php5.c +++ b/sapi/apache_hooks/mod_php5.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ | PHP 4.0 patches by Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: mod_php5.c 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: mod_php5.c 293036 2010-01-03 09:23:27Z sebastian $ */ #include "php_apache_http.h" diff --git a/sapi/apache_hooks/mod_php5.h b/sapi/apache_hooks/mod_php5.h index 4bb98ad04..229ba3e81 100644 --- a/sapi/apache_hooks/mod_php5.h +++ b/sapi/apache_hooks/mod_php5.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -15,7 +15,7 @@ | Author: Rasmus Lerdorf <rasmus@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: mod_php5.h 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: mod_php5.h 293036 2010-01-03 09:23:27Z sebastian $ */ #ifndef MOD_PHP5_H #define MOD_PHP5_H diff --git a/sapi/apache_hooks/php_apache.c b/sapi/apache_hooks/php_apache.c index f26328645..4bc0b14ff 100644 --- a/sapi/apache_hooks/php_apache.c +++ b/sapi/apache_hooks/php_apache.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ | David Sklar <sklar@student.net> | +----------------------------------------------------------------------+ */ -/* $Id: php_apache.c 277250 2009-03-16 10:13:18Z pajoye $ */ +/* $Id: php_apache.c 293036 2010-01-03 09:23:27Z sebastian $ */ #include "php_apache_http.h" diff --git a/sapi/apache_hooks/sapi_apache.c b/sapi/apache_hooks/sapi_apache.c index c4a26af07..0dbee9d36 100644 --- a/sapi/apache_hooks/sapi_apache.c +++ b/sapi/apache_hooks/sapi_apache.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -19,7 +19,7 @@ | Stig Bakken <ssb@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: sapi_apache.c 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: sapi_apache.c 293036 2010-01-03 09:23:27Z sebastian $ */ #include "php_apache_http.h" diff --git a/sapi/caudium/caudium.c b/sapi/caudium/caudium.c index c1d89a3a7..4b59c5781 100644 --- a/sapi/caudium/caudium.c +++ b/sapi/caudium/caudium.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: caudium.c 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: caudium.c 293036 2010-01-03 09:23:27Z sebastian $ */ #include "php.h" #ifdef HAVE_CAUDIUM @@ -444,7 +444,7 @@ static void php_info_caudium(ZEND_MODULE_INFO_FUNC_ARGS) { /* char buf[512]; */ php_info_print_table_start(); - php_info_print_table_row(2, "SAPI module version", "$Id: caudium.c 272370 2008-12-31 11:15:49Z sebastian $"); + php_info_print_table_row(2, "SAPI module version", "$Id: caudium.c 293036 2010-01-03 09:23:27Z sebastian $"); /* php_info_print_table_row(2, "Build date", Ns_InfoBuildDate()); php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile()); php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog()); diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index c01dce1dd..c189d3de9 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: cgi_main.c 289795 2009-10-20 12:57:44Z tony2001 $ */ +/* $Id: cgi_main.c 293036 2010-01-03 09:23:27Z sebastian $ */ #include "php.h" #include "php_globals.h" @@ -1634,8 +1634,9 @@ int main(int argc, char *argv[]) * in case some server does something different than above */ (!CGIG(redirect_status_env) || !getenv(CGIG(redirect_status_env))) ) { - SG(sapi_headers).http_response_code = 400; - PUTS("<b>Security Alert!</b> The PHP CGI cannot be accessed directly.\n\n\ + zend_try { + SG(sapi_headers).http_response_code = 400; + PUTS("<b>Security Alert!</b> The PHP CGI cannot be accessed directly.\n\n\ <p>This PHP CGI binary was compiled with force-cgi-redirect enabled. This\n\ means that a page will only be served up if the REDIRECT_STATUS CGI variable is\n\ set, e.g. via an Apache Action directive.</p>\n\ @@ -1644,7 +1645,8 @@ manual page for CGI security</a>.</p>\n\ <p>For more information about changing this behaviour or re-enabling this webserver,\n\ consult the installation file that came with this distribution, or visit \n\ <a href=\"http://php.net/install.windows\">the manual page</a>.</p>\n"); - + } zend_catch { + } zend_end_try(); #if defined(ZTS) && !defined(PHP_DEBUG) /* XXX we're crashing here in msvc6 debug builds at * php_message_handler_for_zend:839 because @@ -1922,9 +1924,9 @@ consult the installation file that came with this distribution, or visit \n\ SG(request_info).no_headers = 1; } #if ZEND_DEBUG - php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2009 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); + php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2010 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); #else - php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2009 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); + php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2010 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); #endif php_request_shutdown((void *) 0); exit_status = 0; @@ -2040,13 +2042,16 @@ consult the installation file that came with this distribution, or visit \n\ */ if (cgi || fastcgi || SG(request_info).path_translated) { if (php_fopen_primary_script(&file_handle TSRMLS_CC) == FAILURE) { - if (errno == EACCES) { - SG(sapi_headers).http_response_code = 403; - PUTS("Access denied.\n"); - } else { - SG(sapi_headers).http_response_code = 404; - PUTS("No input file specified.\n"); - } + zend_try { + if (errno == EACCES) { + SG(sapi_headers).http_response_code = 403; + PUTS("Access denied.\n"); + } else { + SG(sapi_headers).http_response_code = 404; + PUTS("No input file specified.\n"); + } + } zend_catch { + } zend_end_try(); /* we want to serve more requests if this is fastcgi * so cleanup and continue, request shutdown is * handled later */ diff --git a/sapi/cgi/fastcgi.c b/sapi/cgi/fastcgi.c index 156a689c5..df2dc3169 100644 --- a/sapi/cgi/fastcgi.c +++ b/sapi/cgi/fastcgi.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: fastcgi.c 287777 2009-08-26 19:17:32Z pajoye $ */ +/* $Id: fastcgi.c 293777 2010-01-20 16:02:28Z johannes $ */ #include "php.h" #include "fastcgi.h" @@ -255,6 +255,9 @@ void fcgi_shutdown(void) zend_hash_destroy(&fcgi_mgmt_vars); } is_fastcgi = 0; + if (allowed_clients) { + free(allowed_clients); + } } #ifdef _WIN32 diff --git a/sapi/cgi/fastcgi.h b/sapi/cgi/fastcgi.h index c4f62b8da..76217379b 100644 --- a/sapi/cgi/fastcgi.h +++ b/sapi/cgi/fastcgi.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: fastcgi.h 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: fastcgi.h 293036 2010-01-03 09:23:27Z sebastian $ */ /* FastCGI protocol */ diff --git a/sapi/cli/php.1.in b/sapi/cli/php.1.in index 52161973d..c800e127f 100644 --- a/sapi/cli/php.1.in +++ b/sapi/cli/php.1.in @@ -1,4 +1,4 @@ -.TH PHP 1 "2009" "The PHP Group" "Scripting Language" +.TH PHP 1 "2010" "The PHP Group" "Scripting Language" .SH NAME .TP 15 php \- PHP Command Line Interface 'CLI' @@ -69,7 +69,7 @@ specified by \-F to be executed. You can access the input line by \fB$argn\fP. While processing the input lines .B $argi contains the number of the actual line being processed. Further more -the paramters \-B and \-E can be used to execute +the parameters \-B and \-E can be used to execute .IR code (see \-r) before and after all input lines have been processed respectively. Notice that the @@ -304,6 +304,9 @@ Shows information about extension .IR name Shows configuration for extension .B name +.TP +.B \-\-ini +Show configuration file names .SH FILES .TP 15 .B php\-cli.ini @@ -315,7 +318,7 @@ The standard configuration file will only be used when cannot be found. .SH EXAMPLES .TP 5 -\fIphp -r 'echo "Hello World\\n";'\fP +\fIphp \-r 'echo "Hello World\\n";'\fP This command simply writes the text "Hello World" to standard out. .TP \fIphp \-r 'print_r(gd_info());'\fP @@ -339,7 +342,7 @@ configuration information. If you then combine those two Using this PHP command you can count the lines being input. .TP \fIphp \-R '@$l+=count(file($argn));' \-E 'echo "Lines:$l\\n";'\fP -In this example PHP expects each input line beeing a file. It counts all lines +In this example PHP expects each input line being a file. It counts all lines of the files specified by each input line and shows the summarized result. You may combine this with tools like find and change the php scriptlet. .TP @@ -366,7 +369,7 @@ such a first line as shown below: .PD 1 .P .SH SEE ALSO -For a description of PHP see: +For a more or less complete description of PHP look here: .PD 0 .P .B http://www.php.net/manual/ @@ -395,7 +398,7 @@ contributors all around the world. .SH VERSION INFORMATION This manpage describes \fBphp\fP, version @PHP_VERSION@. .SH COPYRIGHT -Copyright \(co 1997\-2009 The PHP Group +Copyright \(co 1997\-2010 The PHP Group .LP This source file is subject to version 3.01 of the PHP license, that is bundled with this package in the file LICENSE, and is diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index aeade0940..2b372906b 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_cli.c 287973 2009-09-02 20:02:17Z pajoye $ */ +/* $Id: php_cli.c 293036 2010-01-03 09:23:27Z sebastian $ */ #include "php.h" #include "php_globals.h" @@ -76,8 +76,10 @@ #endif #if (HAVE_LIBREADLINE || HAVE_LIBEDIT) && !defined(COMPILE_DL_READLINE) +#if HAVE_LIBEDIT +#include <editline/readline.h> +#else #include <readline/readline.h> -#if !HAVE_LIBEDIT #include <readline/history.h> #endif #include "php_cli_readline.h" @@ -829,7 +831,7 @@ int main(int argc, char *argv[]) } request_started = 1; - php_printf("PHP %s (%s) (built: %s %s) %s\nCopyright (c) 1997-2009 The PHP Group\n%s", + php_printf("PHP %s (%s) (built: %s %s) %s\nCopyright (c) 1997-2010 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, #if ZEND_DEBUG && defined(HAVE_GCOV) "(DEBUG GCOV)", diff --git a/sapi/cli/php_cli_readline.c b/sapi/cli/php_cli_readline.c index 66010d7b0..f76f94885 100644 --- a/sapi/cli/php_cli_readline.c +++ b/sapi/cli/php_cli_readline.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_cli_readline.c 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: php_cli_readline.c 293036 2010-01-03 09:23:27Z sebastian $ */ #include "php.h" @@ -49,8 +49,10 @@ #include <unixlib/local.h> #endif +#if HAVE_LIBEDIT +#include <editline/readline.h> +#else #include <readline/readline.h> -#if !HAVE_LIBEDIT #include <readline/history.h> #endif diff --git a/sapi/cli/php_cli_readline.h b/sapi/cli/php_cli_readline.h index d2fd65935..ce68321bc 100644 --- a/sapi/cli/php_cli_readline.h +++ b/sapi/cli/php_cli_readline.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_cli_readline.h 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: php_cli_readline.h 293036 2010-01-03 09:23:27Z sebastian $ */ #include "php.h" diff --git a/sapi/cli/tests/006.phpt b/sapi/cli/tests/006.phpt index e322d7ef7..530bfbd9f 100644 --- a/sapi/cli/tests/006.phpt +++ b/sapi/cli/tests/006.phpt @@ -79,7 +79,7 @@ string(%d) "Extension [ <persistent> extension #%d pcre version <no_version> ] { - Parameters [5] { Parameter #0 [ <required> $regex ] Parameter #1 [ <required> $replace ] - Parameter #2 [ <optional> $subject ] + Parameter #2 [ <required> $subject ] Parameter #3 [ <optional> $limit ] Parameter #4 [ <optional> &$count ] } @@ -99,7 +99,7 @@ string(%d) "Extension [ <persistent> extension #%d pcre version <no_version> ] { - Parameters [5] { Parameter #0 [ <required> $regex ] Parameter #1 [ <required> $replace ] - Parameter #2 [ <optional> $subject ] + Parameter #2 [ <required> $subject ] Parameter #3 [ <optional> $limit ] Parameter #4 [ <optional> &$count ] } diff --git a/sapi/continuity/capi.c b/sapi/continuity/capi.c index 250fa1424..9e9421112 100644 --- a/sapi/continuity/capi.c +++ b/sapi/continuity/capi.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -110,7 +110,7 @@ PHP_MSHUTDOWN_FUNCTION(continuity) PHP_MINFO_FUNCTION(continuity) { php_info_print_table_start(); - php_info_print_table_row(2, "Continuity Module Revision", "$Revision: 272370 $"); + php_info_print_table_row(2, "Continuity Module Revision", "$Revision: 293036 $"); php_info_print_table_row(2, "Server Version", conFget_build()); #ifdef CONTINUITY_CDPEXT php_info_print_table_row(2,"CDP Extensions", "enabled"); diff --git a/sapi/embed/php_embed.c b/sapi/embed/php_embed.c index e32c3a387..85040b19f 100644 --- a/sapi/embed/php_embed.c +++ b/sapi/embed/php_embed.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -15,7 +15,7 @@ | Author: Edin Kadribasic <edink@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: php_embed.c 286569 2009-07-30 20:20:56Z garretts $ */ +/* $Id: php_embed.c 293036 2010-01-03 09:23:27Z sebastian $ */ #include "php_embed.h" #include "ext/standard/php_standard.h" diff --git a/sapi/embed/php_embed.h b/sapi/embed/php_embed.h index 19d1c982e..983b1aaad 100644 --- a/sapi/embed/php_embed.h +++ b/sapi/embed/php_embed.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -15,7 +15,7 @@ | Author: Edin Kadribasic <edink@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: php_embed.h 286569 2009-07-30 20:20:56Z garretts $ */ +/* $Id: php_embed.h 293036 2010-01-03 09:23:27Z sebastian $ */ #ifndef _PHP_EMBED_H_ #define _PHP_EMBED_H_ diff --git a/sapi/isapi/php5isapi.c b/sapi/isapi/php5isapi.c index 0f44efe4a..60e37b9c6 100644 --- a/sapi/isapi/php5isapi.c +++ b/sapi/isapi/php5isapi.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ | Ben Mansell <ben@zeus.com> (Zeus Support) | +----------------------------------------------------------------------+ */ -/* $Id: php5isapi.c 278022 2009-03-30 14:24:16Z kalle $ */ +/* $Id: php5isapi.c 293036 2010-01-03 09:23:27Z sebastian $ */ #include "php.h" #include <httpext.h> diff --git a/sapi/milter/php_milter.c b/sapi/milter/php_milter.c index baa62b2de..22f58c3cf 100644 --- a/sapi/milter/php_milter.c +++ b/sapi/milter/php_milter.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_milter.c 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: php_milter.c 293036 2010-01-03 09:23:27Z sebastian $ */ #include "php.h" #include "php_globals.h" @@ -1102,7 +1102,7 @@ int main(int argc, char *argv[]) } SG(headers_sent) = 1; SG(request_info).no_headers = 1; - php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2009 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); + php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2010 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); php_end_ob_buffers(1 TSRMLS_CC); exit(1); break; diff --git a/sapi/nsapi/nsapi.c b/sapi/nsapi/nsapi.c index cf088b1d6..dc6eb4019 100644 --- a/sapi/nsapi/nsapi.c +++ b/sapi/nsapi/nsapi.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: nsapi.c 286722 2009-08-03 10:13:49Z thetaphi $ */ +/* $Id: nsapi.c 293036 2010-01-03 09:23:27Z sebastian $ */ /* * PHP includes @@ -68,6 +68,12 @@ */ #include "nsapi.h" +/* fix for gcc4 visibility issue */ +#ifndef PHP_WIN32 +# undef NSAPI_PUBLIC +# define NSAPI_PUBLIC PHPAPI +#endif + #define NSLS_D struct nsapi_request_context *request_context #define NSLS_DC , NSLS_D #define NSLS_C request_context @@ -131,14 +137,6 @@ static size_t nsapi_client_size = sizeof(nsapi_client)/sizeof(nsapi_client[0]); /* this parameters to "Service"/"Error" are NSAPI ones which should not be php.ini keys and are excluded */ static char *nsapi_exclude_from_ini_entries[] = { "fn", "type", "method", "directive", "code", "reason", "script", "bucket", NULL }; -static char *nsapi_strdup(char *str) -{ - if (str != NULL) { - return STRDUP(str); - } - return NULL; -} - static void nsapi_free(void *addr) { if (addr != NULL) { @@ -314,7 +312,7 @@ PHP_MSHUTDOWN_FUNCTION(nsapi) PHP_MINFO_FUNCTION(nsapi) { php_info_print_table_start(); - php_info_print_table_row(2, "NSAPI Module Revision", "$Revision: 286722 $"); + php_info_print_table_row(2, "NSAPI Module Revision", "$Revision: 293036 $"); php_info_print_table_row(2, "Server Software", system_version()); php_info_print_table_row(2, "Sub-requests with nsapi_virtual()", (nsapi_servact_service)?((zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0))?"not supported with zlib.output_compression":"enabled"):"not supported on this platform" ); @@ -500,7 +498,7 @@ static int php_nsapi_remove_header(sapi_header_struct *sapi_header TSRMLS_DC) nsapi_request_context *rc = (nsapi_request_context *)SG(server_context); /* copy the header, because NSAPI needs reformatting and we do not want to change the parameter */ - header_name = nsapi_strdup(sapi_header->header); + header_name = pool_strdup(rc->sn->pool, sapi_header->header); /* extract name, this works, if only the header without ':' is given, too */ if (p = strchr(header_name, ':')) { @@ -514,7 +512,7 @@ static int php_nsapi_remove_header(sapi_header_struct *sapi_header TSRMLS_DC) /* remove the header */ param_free(pblock_remove(header_name, rc->rq->srvhdrs)); - nsapi_free(header_name); + pool_free(rc->sn->pool, header_name); return ZEND_HASH_APPLY_KEEP; } @@ -538,7 +536,7 @@ static int sapi_nsapi_header_handler(sapi_header_struct *sapi_header, sapi_heade case SAPI_HEADER_ADD: case SAPI_HEADER_REPLACE: /* copy the header, because NSAPI needs reformatting and we do not want to change the parameter */ - header_name = nsapi_strdup(sapi_header->header); + header_name = pool_strdup(rc->sn->pool, sapi_header->header); /* split header and align pointer for content */ header_content = strchr(header_name, ':'); @@ -561,7 +559,7 @@ static int sapi_nsapi_header_handler(sapi_header_struct *sapi_header, sapi_heade pblock_nvinsert(header_name, header_content, rc->rq->srvhdrs); } - nsapi_free(header_name); + pool_free(rc->sn->pool, header_name); return SAPI_HEADER_ADD; default: @@ -734,8 +732,8 @@ static void sapi_nsapi_register_server_variables(zval *track_vars_array TSRMLS_D /* DOCUMENT_ROOT */ if (value = request_translate_uri("/", rc->sn)) { - value[strlen(value) - 1] = '\0'; - php_register_variable("DOCUMENT_ROOT", value, track_vars_array TSRMLS_CC); + pos = strlen(value); + php_register_variable_safe("DOCUMENT_ROOT", value, pos-1, track_vars_array TSRMLS_CC); nsapi_free(value); } @@ -750,6 +748,8 @@ static void sapi_nsapi_register_server_variables(zval *track_vars_array TSRMLS_D /* Create full Request-URI & Script-Name */ if (SG(request_info).request_uri) { + pos = strlen(SG(request_info).request_uri); + if (SG(request_info).query_string) { spprintf(&value, 0, "%s?%s", SG(request_info).request_uri, SG(request_info).query_string); if (value) { @@ -757,21 +757,16 @@ static void sapi_nsapi_register_server_variables(zval *track_vars_array TSRMLS_D efree(value); } } else { - php_register_variable("REQUEST_URI", SG(request_info).request_uri, track_vars_array TSRMLS_CC); + php_register_variable_safe("REQUEST_URI", SG(request_info).request_uri, pos, track_vars_array TSRMLS_CC); } - if (value = nsapi_strdup(SG(request_info).request_uri)) { - if (rc->path_info) { - pos = strlen(SG(request_info).request_uri) - strlen(rc->path_info); - if (pos>=0) { - value[pos] = '\0'; - } else { - value[0]='\0'; - } + if (rc->path_info) { + pos -= strlen(rc->path_info); + if (pos<0) { + pos = 0; } - php_register_variable("SCRIPT_NAME", value, track_vars_array TSRMLS_CC); - nsapi_free(value); } + php_register_variable_safe("SCRIPT_NAME", SG(request_info).request_uri, pos, track_vars_array TSRMLS_CC); } php_register_variable("SCRIPT_FILENAME", SG(request_info).path_translated, track_vars_array TSRMLS_CC); @@ -1014,21 +1009,25 @@ int NSAPI_PUBLIC php5_execute(pblock *pb, Session *sn, Request *rq) } } - request_context = (nsapi_request_context *)MALLOC(sizeof(nsapi_request_context)); + request_context = (nsapi_request_context *)pool_malloc(sn->pool, sizeof(nsapi_request_context)); + if (!request_context) { + log_error(LOG_CATASTROPHE, pblock_findval("fn", pb), sn, rq, "Insufficient memory to process PHP request!"); + return REQ_ABORTED; + } request_context->pb = pb; request_context->sn = sn; request_context->rq = rq; request_context->read_post_bytes = 0; request_context->fixed_script = fixed_script; request_context->http_error = (error_directive) ? rq->status_num : 0; - request_context->path_info = nsapi_strdup(path_info); + request_context->path_info = path_info; SG(server_context) = request_context; - SG(request_info).query_string = nsapi_strdup(query_string); - SG(request_info).request_uri = nsapi_strdup(uri); - SG(request_info).request_method = nsapi_strdup(request_method); - SG(request_info).path_translated = nsapi_strdup(path_translated); - SG(request_info).content_type = nsapi_strdup(content_type); + SG(request_info).query_string = query_string; + SG(request_info).request_uri = uri; + SG(request_info).request_method = request_method; + SG(request_info).path_translated = path_translated; + SG(request_info).content_type = content_type; SG(request_info).content_length = (content_length == NULL) ? 0 : strtoul(content_length, 0, 0); SG(sapi_headers).http_response_code = (error_directive) ? rq->status_num : 200; @@ -1068,14 +1067,7 @@ int NSAPI_PUBLIC php5_execute(pblock *pb, Session *sn, Request *rq) } } - nsapi_free(request_context->path_info); - nsapi_free(SG(request_info).query_string); - nsapi_free(SG(request_info).request_uri); - nsapi_free((void*)(SG(request_info).request_method)); - nsapi_free(SG(request_info).path_translated); - nsapi_free((void*)(SG(request_info).content_type)); - - FREE(request_context); + pool_free(sn->pool, request_context); SG(server_context) = NULL; return retval; diff --git a/sapi/phttpd/php_phttpd.h b/sapi/phttpd/php_phttpd.h index a827d8cb7..168c58af6 100644 --- a/sapi/phttpd/php_phttpd.h +++ b/sapi/phttpd/php_phttpd.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/sapi/phttpd/phttpd.c b/sapi/phttpd/phttpd.c index 2934abfbf..11df607db 100644 --- a/sapi/phttpd/phttpd.c +++ b/sapi/phttpd/phttpd.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/sapi/pi3web/pi3web_sapi.c b/sapi/pi3web/pi3web_sapi.c index 7af5d5061..f6cd9b614 100644 --- a/sapi/pi3web/pi3web_sapi.c +++ b/sapi/pi3web/pi3web_sapi.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pi3web_sapi.c 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: pi3web_sapi.c 293036 2010-01-03 09:23:27Z sebastian $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -57,7 +57,7 @@ static void php_info_pi3web(ZEND_MODULE_INFO_FUNC_ARGS) PUTS("<table border=0 cellpadding=3 cellspacing=1 width=600 align=center>\n"); PUTS("<tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">Pi3Web Server Information</th></tr>\n"); php_info_print_table_header(2, "Information Field", "Value"); - php_info_print_table_row(2, "Pi3Web SAPI module version", "$Id: pi3web_sapi.c 272370 2008-12-31 11:15:49Z sebastian $"); + php_info_print_table_row(2, "Pi3Web SAPI module version", "$Id: pi3web_sapi.c 293036 2010-01-03 09:23:27Z sebastian $"); php_info_print_table_row(2, "Server Name Stamp", HTTPCore_getServerStamp()); snprintf(variable_buf, 511, "%d", HTTPCore_debugEnabled()); php_info_print_table_row(2, "Debug Enabled", variable_buf); diff --git a/sapi/roxen/roxen.c b/sapi/roxen/roxen.c index eabe14d63..614a89e29 100644 --- a/sapi/roxen/roxen.c +++ b/sapi/roxen/roxen.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: roxen.c 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: roxen.c 293036 2010-01-03 09:23:27Z sebastian $ */ #include "php.h" #ifdef HAVE_ROXEN @@ -438,7 +438,7 @@ static void php_info_roxen(ZEND_MODULE_INFO_FUNC_ARGS) { /* char buf[512]; */ php_info_print_table_start(); - php_info_print_table_row(2, "SAPI module version", "$Id: roxen.c 272370 2008-12-31 11:15:49Z sebastian $"); + php_info_print_table_row(2, "SAPI module version", "$Id: roxen.c 293036 2010-01-03 09:23:27Z sebastian $"); /* php_info_print_table_row(2, "Build date", Ns_InfoBuildDate()); php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile()); php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog()); diff --git a/sapi/thttpd/php_thttpd.h b/sapi/thttpd/php_thttpd.h index cc6f4f7bd..43e9ad807 100644 --- a/sapi/thttpd/php_thttpd.h +++ b/sapi/thttpd/php_thttpd.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/sapi/thttpd/thttpd.c b/sapi/thttpd/thttpd.c index 187bddf65..f2530ecf5 100644 --- a/sapi/thttpd/thttpd.c +++ b/sapi/thttpd/thttpd.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: thttpd.c 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: thttpd.c 293036 2010-01-03 09:23:27Z sebastian $ */ #include "php.h" #include "SAPI.h" diff --git a/sapi/tux/php_tux.c b/sapi/tux/php_tux.c index c94ed0845..df66a76e7 100644 --- a/sapi/tux/php_tux.c +++ b/sapi/tux/php_tux.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/sapi/webjames/php_webjames.h b/sapi/webjames/php_webjames.h index eac8b11b8..a0532c7a3 100644 --- a/sapi/webjames/php_webjames.h +++ b/sapi/webjames/php_webjames.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/sapi/webjames/webjames.c b/sapi/webjames/webjames.c index 6783b5ed1..bbe5084e6 100644 --- a/sapi/webjames/webjames.c +++ b/sapi/webjames/webjames.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | |
