diff options
| author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:37:27 -0400 |
|---|---|---|
| committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:37:27 -0400 |
| commit | 2d4e5b09576bb4f0ba716cc82cdf29ea04d9184b (patch) | |
| tree | 41ccc042009cba53e4ce43e727fcba4c1cfbf7f3 /sapi/apache2handler | |
| parent | d29a4fd2dd3b5d4cf6e80b602544d7b71d794e76 (diff) | |
| download | php-upstream/5.2.2.tar.gz | |
Imported Upstream version 5.2.2upstream/5.2.2
Diffstat (limited to 'sapi/apache2handler')
| -rw-r--r-- | sapi/apache2handler/apache_config.c | 4 | ||||
| -rw-r--r-- | sapi/apache2handler/mod_php5.c | 4 | ||||
| -rw-r--r-- | sapi/apache2handler/php_apache.h | 4 | ||||
| -rw-r--r-- | sapi/apache2handler/php_functions.c | 22 | ||||
| -rw-r--r-- | sapi/apache2handler/sapi_apache2.c | 58 |
5 files changed, 61 insertions, 31 deletions
diff --git a/sapi/apache2handler/apache_config.c b/sapi/apache2handler/apache_config.c index bd80bb86f..64bcb0bc1 100644 --- a/sapi/apache2handler/apache_config.c +++ b/sapi/apache2handler/apache_config.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2007 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,v 1.7.2.1.2.1 2006/06/09 15:13:39 mike Exp $ */ +/* $Id: apache_config.c,v 1.7.2.1.2.2 2007/01/01 09:36:12 sebastian Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS diff --git a/sapi/apache2handler/mod_php5.c b/sapi/apache2handler/mod_php5.c index ad1be19fe..6c1ea1655 100644 --- a/sapi/apache2handler/mod_php5.c +++ b/sapi/apache2handler/mod_php5.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2007 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,v 1.5.2.1 2006/01/01 12:50:18 sniper Exp $ */ +/* $Id: mod_php5.c,v 1.5.2.1.2.1 2007/01/01 09:36:12 sebastian Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h index e4030cbbe..51a8a9bbd 100644 --- a/sapi/apache2handler/php_apache.h +++ b/sapi/apache2handler/php_apache.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2007 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,v 1.8.2.1.2.1 2006/05/28 20:32:00 mike Exp $ */ +/* $Id: php_apache.h,v 1.8.2.1.2.2 2007/01/01 09:36:12 sebastian Exp $ */ #ifndef PHP_APACHE_H #define PHP_APACHE_H diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c index d1ffb22e8..ab60415cb 100644 --- a/sapi/apache2handler/php_functions.c +++ b/sapi/apache2handler/php_functions.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2007 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,v 1.18.2.6 2006/01/03 20:13:07 iliaa Exp $ */ +/* $Id: php_functions.c,v 1.18.2.6.2.5 2007/02/24 02:17:28 helly Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -42,7 +42,7 @@ #include "util_script.h" #include "http_core.h" #include "ap_mpm.h" -#if !defined(WIN32) && !defined(WINNT) +#if !defined(WIN32) && !defined(WINNT) && !defined(NETWARE) #include "unixd.h" #endif @@ -333,7 +333,11 @@ PHP_FUNCTION(apache_getenv) static char *php_apache_get_version() { +#if MODULE_MAGIC_NUMBER_MAJOR >= 20060905 + return (char *) ap_get_server_banner(); +#else return (char *) ap_get_server_version(); +#endif } /* {{{ proto string apache_get_version(void) @@ -378,7 +382,7 @@ PHP_MINFO_FUNCTION(apache) int n, max_requests; char *p; server_rec *serv = ((php_struct *) SG(server_context))->r->server; -#if !defined(WIN32) && !defined(WINNT) +#if !defined(WIN32) && !defined(WINNT) && !defined(NETWARE) AP_DECLARE_DATA extern unixd_config_rec unixd_config; #endif @@ -399,23 +403,23 @@ PHP_MINFO_FUNCTION(apache) if (apv && *apv) { php_info_print_table_row(2, "Apache Version", apv); } - sprintf(tmp, "%d", MODULE_MAGIC_NUMBER); + snprintf(tmp, sizeof(tmp), "%d", MODULE_MAGIC_NUMBER); php_info_print_table_row(2, "Apache API Version", tmp); if (serv->server_admin && *(serv->server_admin)) { php_info_print_table_row(2, "Server Administrator", serv->server_admin); } - sprintf(tmp, "%s:%u", serv->server_hostname, serv->port); + snprintf(tmp, sizeof(tmp), "%s:%u", serv->server_hostname, serv->port); php_info_print_table_row(2, "Hostname:Port", tmp); -#if !defined(WIN32) && !defined(WINNT) - sprintf(tmp, "%s(%d)/%d", unixd_config.user_name, unixd_config.user_id, unixd_config.group_id); +#if !defined(WIN32) && !defined(WINNT) && !defined(NETWARE) + snprintf(tmp, sizeof(tmp), "%s(%d)/%d", unixd_config.user_name, unixd_config.user_id, unixd_config.group_id); php_info_print_table_row(2, "User/Group", tmp); #endif ap_mpm_query(AP_MPMQ_MAX_REQUESTS_DAEMON, &max_requests); - sprintf(tmp, "Per Child: %d - Keep Alive: %s - Max Per Connection: %d", max_requests, (serv->keep_alive ? "on":"off"), serv->keep_alive_max); + snprintf(tmp, sizeof(tmp), "Per Child: %d - Keep Alive: %s - Max Per Connection: %d", max_requests, (serv->keep_alive ? "on":"off"), serv->keep_alive_max); php_info_print_table_row(2, "Max Requests", tmp); apr_snprintf(tmp, sizeof tmp, diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index 21bce6128..56b449c74 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2007 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,v 1.57.2.10.2.6 2006/08/10 13:43:18 tony2001 Exp $ */ +/* $Id: sapi_apache2.c,v 1.57.2.10.2.13 2007/01/01 09:36:12 sebastian Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -129,9 +129,14 @@ php_apache_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) /* httpd requires that r->status_line is set to the first digit of * the status-code: */ - if (sline && strlen(sline) > 12 && strncmp(sline, "HTTP/1.", 7) == 0 - && sline[8] == ' ') { + if (sline && strlen(sline) > 12 && strncmp(sline, "HTTP/1.", 7) == 0 && sline[8] == ' ') { ctx->r->status_line = apr_pstrdup(ctx->r->pool, sline + 9); + ctx->r->proto_num = 1000 + (sline[7]-'0'); + if ((sline[7]-'0') == 0) { + apr_table_set(ctx->r->subprocess_env, "force-response-1.0", "true"); + } else { + apr_table_set(ctx->r->subprocess_env, "force-response-1.1", "true"); + } } /* call ap_set_content_type only once, else each time we call it, @@ -232,13 +237,20 @@ php_apache_sapi_register_variables(zval *track_vars_array TSRMLS_DC) php_struct *ctx = SG(server_context); const apr_array_header_t *arr = apr_table_elts(ctx->r->subprocess_env); char *key, *val; + int new_val_len; APR_ARRAY_FOREACH_OPEN(arr, key, val) - if (!val) val = ""; - php_register_variable(key, val, track_vars_array TSRMLS_CC); + if (!val) { + val = ""; + } + if (sapi_module.input_filter(PARSE_SERVER, key, &val, strlen(val), &new_val_len TSRMLS_CC)) { + php_register_variable_safe(key, val, new_val_len, track_vars_array TSRMLS_CC); + } APR_ARRAY_FOREACH_CLOSE() - php_register_variable("PHP_SELF", ctx->r->uri, track_vars_array TSRMLS_CC); + if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &ctx->r->uri, strlen(ctx->r->uri), &new_val_len TSRMLS_CC)) { + php_register_variable_safe("PHP_SELF", ctx->r->uri, new_val_len, track_vars_array TSRMLS_CC); + } } static void @@ -455,6 +467,20 @@ static void php_apache_ini_dtor(request_rec *r, request_rec *p TSRMLS_DC) { if (strcmp(r->protocol, "INCLUDED")) { zend_try { zend_ini_deactivate(TSRMLS_C); } zend_end_try(); + } else { +typedef struct { + HashTable config; +} php_conf_rec; + char *str; + 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) + ) { + zend_restore_ini_entry(str, str_len, ZEND_INI_STAGE_SHUTDOWN); + } } if (p) { ((php_struct *)SG(server_context))->r = p; @@ -561,8 +587,13 @@ zend_first_try { } } - /* check if comming due to ErrorDocument */ - if (parent_req && parent_req->status != HTTP_OK) { + /* + * 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. + */ + if (parent_req && parent_req->status != HTTP_OK && parent_req->status != 413 && strcmp(r->protocol, "INCLUDED")) { parent_req = NULL; goto normal; } @@ -593,14 +624,9 @@ zend_first_try { } else { zend_execute_scripts(ZEND_INCLUDE TSRMLS_CC, NULL, 1, &zfd); } -#if MEMORY_LIMIT - { - char *mem_usage; - mem_usage = apr_psprintf(ctx->r->pool, "%u", zend_memory_peak_usage(1 TSRMLS_CC)); - apr_table_set(r->notes, "mod_php_memory_usage", mem_usage); - } -#endif + apr_table_set(r->notes, "mod_php_memory_usage", + apr_psprintf(ctx->r->pool, "%u", zend_memory_peak_usage(1 TSRMLS_CC))); } } zend_end_try(); |
