diff options
author | Jani Taskinen <jani@php.net> | 2010-03-12 10:28:59 +0000 |
---|---|---|
committer | Jani Taskinen <jani@php.net> | 2010-03-12 10:28:59 +0000 |
commit | af49e58f5155383a440041c77cc1ecbaf507fde7 (patch) | |
tree | 01ffe64d6f78450fb828f73d0e1e59f3cc7c8c76 /sapi/apache/php_apache.c | |
parent | ea539c8b88c9278363b6de0b39446e4e8e043391 (diff) | |
download | php-git-af49e58f5155383a440041c77cc1ecbaf507fde7.tar.gz |
- Reverted r296062 and r296065
Diffstat (limited to 'sapi/apache/php_apache.c')
-rw-r--r-- | sapi/apache/php_apache.c | 79 |
1 files changed, 41 insertions, 38 deletions
diff --git a/sapi/apache/php_apache.c b/sapi/apache/php_apache.c index e2055ccb48..8faa6f34f0 100644 --- a/sapi/apache/php_apache.c +++ b/sapi/apache/php_apache.c @@ -93,6 +93,8 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_apache_reset_timeout, 0) ZEND_END_ARG_INFO() + + const zend_function_entry apache_functions[] = { PHP_FE(virtual, arginfo_apache_virtual) PHP_FE(apache_request_headers, arginfo_apache_request_headers) @@ -108,6 +110,7 @@ const zend_function_entry apache_functions[] = { {NULL, NULL, NULL} }; + PHP_INI_BEGIN() STD_PHP_INI_ENTRY("xbithack", "0", PHP_INI_ALL, OnUpdateLong, xbithack, php_apache_info_struct, php_apache_info) STD_PHP_INI_ENTRY("engine", "1", PHP_INI_ALL, OnUpdateLong, engine, php_apache_info_struct, php_apache_info) @@ -115,11 +118,14 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("child_terminate", "0", PHP_INI_ALL, OnUpdateLong, terminate_child, php_apache_info_struct, php_apache_info) PHP_INI_END() + + static void php_apache_globals_ctor(php_apache_info_struct *apache_globals TSRMLS_DC) { apache_globals->in_request = 0; } + static PHP_MINIT_FUNCTION(apache) { #ifdef ZTS @@ -131,6 +137,7 @@ static PHP_MINIT_FUNCTION(apache) return SUCCESS; } + static PHP_MSHUTDOWN_FUNCTION(apache) { UNREGISTER_INI_ENTRIES(); @@ -139,13 +146,13 @@ static PHP_MSHUTDOWN_FUNCTION(apache) zend_module_entry apache_module_entry = { STANDARD_MODULE_HEADER, - "apache", - apache_functions, - PHP_MINIT(apache), - PHP_MSHUTDOWN(apache), - NULL, - NULL, - PHP_MINFO(apache), + "apache", + apache_functions, + PHP_MINIT(apache), + PHP_MSHUTDOWN(apache), + NULL, + NULL, + PHP_MINFO(apache), NO_VERSION_YET, STANDARD_MODULE_PROPERTIES }; @@ -171,6 +178,7 @@ PHP_MINFO_FUNCTION(apache) serv = ((request_rec *) SG(server_context))->server; + php_info_print_table_start(); #ifdef PHP_WIN32 @@ -188,7 +196,7 @@ PHP_MINFO_FUNCTION(apache) if (apv && *apv) { php_info_print_table_row(2, "Apache Version", apv); - } + } #ifdef APACHE_RELEASE snprintf(output_buf, sizeof(output_buf), "%d", APACHE_RELEASE); @@ -214,7 +222,7 @@ PHP_MINFO_FUNCTION(apache) php_info_print_table_row(2, "Server Root", server_root); strcpy(modulenames, ""); - for (modp = top_module; modp; modp = modp->next) { + for(modp = top_module; modp; modp = modp->next) { strlcpy(name, modp->name, sizeof(name)); if ((p = strrchr(name, '.'))) { *p='\0'; /* Cut off ugly .c extensions on module names */ @@ -240,14 +248,14 @@ PHP_MINFO_FUNCTION(apache) r = ((request_rec *) SG(server_context)); arr = table_elts(r->subprocess_env); elts = (table_entry *)arr->elts; - + SECTION("Apache Environment"); - php_info_print_table_start(); + php_info_print_table_start(); php_info_print_table_header(2, "Variable", "Value"); for (i=0; i < arr->nelts; i++) { php_info_print_table_row(2, elts[i].key, elts[i].val); } - php_info_print_table_end(); + php_info_print_table_end(); } { @@ -255,7 +263,7 @@ PHP_MINFO_FUNCTION(apache) table_entry *env; int i; request_rec *r; - + r = ((request_rec *) SG(server_context)); SECTION("HTTP Headers Information"); php_info_print_table_start(); @@ -271,7 +279,7 @@ PHP_MINFO_FUNCTION(apache) php_info_print_table_colspan_header(2, "HTTP Response Headers"); env_arr = table_elts(r->headers_out); env = (table_entry *)env_arr->elts; - for (i = 0; i < env_arr->nelts; ++i) { + for(i = 0; i < env_arr->nelts; ++i) { if (env[i].key) { php_info_print_table_row(2, env[i].key, env[i].val); } @@ -345,37 +353,34 @@ PHP_FUNCTION(virtual) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { return; } - + if (!(rr = sub_req_lookup_uri (filename, ((request_rec *) SG(server_context))))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - URI lookup failed", filename); - if (rr) { + if (rr) destroy_sub_req (rr); - } RETURN_FALSE; } if (rr->status != 200) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - error finding URI", filename); - if (rr) { + if (rr) destroy_sub_req (rr); - } RETURN_FALSE; } - php_output_end_all(TSRMLS_C); + php_end_ob_buffers(1 TSRMLS_CC); php_header(TSRMLS_C); if (run_sub_req(rr)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - request execution failed", filename); - if (rr) { + if (rr) destroy_sub_req (rr); - } RETURN_FALSE; } - if (rr) { + if (rr) destroy_sub_req (rr); - } + RETURN_TRUE; } /* }}} */ @@ -404,7 +409,7 @@ PHP_FUNCTION(apache_request_headers) if (add_assoc_string(return_value, tenv[i].key, (tenv[i].val==NULL) ? "" : tenv[i].val, 1)==FAILURE) { RETURN_FALSE; } - } + } } /* }}} */ @@ -441,10 +446,8 @@ PHP_FUNCTION(apache_setenv) return; } - while (top) { - if (r->prev) { - r = r->prev; - } + while(top) { + if(r->prev) r = r->prev; else break; } @@ -477,16 +480,16 @@ PHP_FUNCTION(apache_lookup_uri) add_property_string(return_value,"the_request", rr->the_request, 1); } if (rr->status_line) { - add_property_string(return_value,"status_line", (char *)rr->status_line, 1); + add_property_string(return_value,"status_line", (char *)rr->status_line, 1); } if (rr->method) { - add_property_string(return_value,"method", (char *)rr->method, 1); + add_property_string(return_value,"method", (char *)rr->method, 1); } if (rr->content_type) { add_property_string(return_value,"content_type", (char *)rr->content_type, 1); } if (rr->handler) { - add_property_string(return_value,"handler", (char *)rr->handler, 1); + add_property_string(return_value,"handler", (char *)rr->handler, 1); } if (rr->uri) { add_property_string(return_value,"uri", rr->uri, 1); @@ -516,11 +519,11 @@ PHP_FUNCTION(apache_lookup_uri) if (rr->unparsed_uri) { add_property_string(return_value,"unparsed_uri", rr->unparsed_uri, 1); } - if (rr->mtime) { + if(rr->mtime) { add_property_long(return_value,"mtime", rr->mtime); } #endif - if (rr->request_time) { + if(rr->request_time) { add_property_long(return_value,"request_time", rr->request_time); } @@ -543,7 +546,7 @@ PHP_FUNCTION(apache_exec_uri) return; } - if (!(rr = ap_sub_req_lookup_uri(filename, ((request_rec *) SG(server_context))))) { + if(!(rr = ap_sub_req_lookup_uri(filename, ((request_rec *) SG(server_context))))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "URI lookup failed", filename); RETURN_FALSE; } @@ -573,16 +576,16 @@ PHP_FUNCTION(apache_get_modules) { int n; char *p; - + array_init(return_value); - + for (n = 0; ap_loaded_modules[n]; ++n) { char *s = (char *) ap_loaded_modules[n]->name; if ((p = strchr(s, '.'))) { add_next_index_stringl(return_value, s, (p - s), 1); } else { add_next_index_string(return_value, s, 1); - } + } } } /* }}} */ |