mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Many patches. I hope I remember them all:
- Make sapi_module available to external modules (PHPAPI) - Make the php.ini path reported in phpinfo() always point to real full path of the php.ini file - Optimized the ISAPI module not to read unnecessary server variables and read necessary variables at most once.
This commit is contained in:
parent
348f6c609c
commit
bd0ac7fe14
19 changed files with 294 additions and 264 deletions
3
NEWS
3
NEWS
|
@ -2,6 +2,9 @@ PHP 4.0 NEWS
|
|||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
|
||||
?? ??? 200?, Version 4.0.5
|
||||
- Made the php.ini path reported in phpinfo() always point to the absolute
|
||||
path that was opened (Zeev)
|
||||
- Made the INI mechanism thread safe (Zeev, Zend engine)
|
||||
- Changed setlocale() to use LC_* constants. (Jani)
|
||||
- ctype functions now follow the extension naming conventions (Hartmut)
|
||||
- Added iconv() function (using libc or libiconv) (Stig)
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
#define SECTION(name) PUTS("<H2 align=\"center\">" name "</H2>\n")
|
||||
|
||||
PHPAPI extern char *php_ini_path;
|
||||
PHPAPI extern char *php_ini_opened_path;
|
||||
|
||||
static int _display_module_info(zend_module_entry *module, void *arg)
|
||||
{
|
||||
|
@ -197,7 +197,7 @@ PHPAPI void php_print_info(int flag)
|
|||
php_info_print_table_row(2, "Virtual Directory Support", "disabled" );
|
||||
#endif
|
||||
|
||||
php_info_print_table_row(2, "Configuration File (php.ini) Path", php_ini_path?php_ini_path:CONFIGURATION_FILE_PATH );
|
||||
php_info_print_table_row(2, "Configuration File (php.ini) Path", php_ini_opened_path?php_ini_opened_path:CONFIGURATION_FILE_PATH);
|
||||
|
||||
#if ZEND_DEBUG
|
||||
php_info_print_table_row(2, "ZEND_DEBUG", "enabled" );
|
||||
|
|
|
@ -54,7 +54,7 @@ static void sapi_globals_ctor(sapi_globals_struct *sapi_globals)
|
|||
}
|
||||
|
||||
/* True globals (no need for thread safety) */
|
||||
sapi_module_struct sapi_module;
|
||||
SAPI_API sapi_module_struct sapi_module;
|
||||
SAPI_API void (*sapi_error)(int error_type, const char *message, ...);
|
||||
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ typedef struct _sapi_post_entry sapi_post_entry;
|
|||
typedef struct _sapi_module_struct sapi_module_struct;
|
||||
|
||||
|
||||
extern sapi_module_struct sapi_module; /* true global */
|
||||
extern SAPI_API sapi_module_struct sapi_module; /* true global */
|
||||
|
||||
/* Some values in this structure needs to be filled in before
|
||||
* calling sapi_activate(). We WILL change the `char *' entries,
|
||||
|
@ -188,6 +188,8 @@ struct _sapi_module_struct {
|
|||
void (*register_server_variables)(zval *track_vars_array ELS_DC SLS_DC PLS_DC);
|
||||
void (*log_message)(char *message);
|
||||
|
||||
char *php_ini_path_override;
|
||||
|
||||
void (*block_interruptions)(void);
|
||||
void (*unblock_interruptions)(void);
|
||||
|
||||
|
@ -222,7 +224,7 @@ struct _sapi_post_entry {
|
|||
SAPI_POST_READER_FUNC(sapi_read_standard_form_data);
|
||||
SAPI_POST_READER_FUNC(php_default_post_reader);
|
||||
|
||||
#define STANDARD_SAPI_MODULE_PROPERTIES NULL
|
||||
#define STANDARD_SAPI_MODULE_PROPERTIES NULL, NULL
|
||||
|
||||
#endif /* SAPI_H */
|
||||
|
||||
|
|
13
main/main.c
13
main/main.c
|
@ -106,8 +106,6 @@ void *gLock; /*mutex variable */
|
|||
|
||||
/* True globals (no need for thread safety) */
|
||||
HashTable configuration_hash;
|
||||
PHPAPI char *php_ini_path = NULL;
|
||||
|
||||
|
||||
#define SAFE_FILENAME(f) ((f)?(f):"-")
|
||||
|
||||
|
@ -700,15 +698,6 @@ void php_request_shutdown(void *dummy)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static int php_config_ini_startup(void)
|
||||
{
|
||||
if (php_init_config() == FAILURE) {
|
||||
php_printf("PHP: Unable to parse configuration file.\n");
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static void php_config_ini_shutdown(void)
|
||||
{
|
||||
|
@ -860,7 +849,7 @@ int php_module_startup(sapi_module_struct *sf)
|
|||
le_index_ptr = zend_register_list_destructors_ex(NULL, NULL, "index pointer", 0);
|
||||
FREE_MUTEX(gLock);
|
||||
|
||||
if (php_config_ini_startup() == FAILURE) {
|
||||
if (php_init_config(sf->php_ini_path_override) == FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
|
|
139
main/php_ini.c
139
main/php_ini.c
|
@ -24,8 +24,9 @@
|
|||
#include "ext/standard/dl.h"
|
||||
#include "zend_extensions.h"
|
||||
|
||||
/* True globals */
|
||||
static HashTable configuration_hash;
|
||||
PHPAPI extern char *php_ini_path;
|
||||
PHPAPI char *php_ini_opened_path=NULL;
|
||||
|
||||
|
||||
static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type)
|
||||
|
@ -145,96 +146,79 @@ static void php_config_ini_parser_cb(zval *arg1, zval *arg2, int callback_type,
|
|||
}
|
||||
|
||||
|
||||
int php_init_config(void)
|
||||
int php_init_config(char *php_ini_path_override)
|
||||
{
|
||||
char *env_location, *php_ini_search_path;
|
||||
int safe_mode_state;
|
||||
char *open_basedir;
|
||||
int free_ini_search_path=0;
|
||||
zend_file_handle fh;
|
||||
PLS_FETCH();
|
||||
|
||||
if (zend_hash_init(&configuration_hash, 0, NULL, (dtor_func_t) pvalue_config_destructor, 1)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
#if USE_CONFIG_FILE
|
||||
{
|
||||
char *env_location,*default_location,*php_ini_search_path;
|
||||
int safe_mode_state = PG(safe_mode);
|
||||
char *open_basedir = PG(open_basedir);
|
||||
char *opened_path;
|
||||
int free_default_location=0;
|
||||
zend_file_handle fh;
|
||||
|
||||
env_location = getenv("PHPRC");
|
||||
if (!env_location) {
|
||||
env_location="";
|
||||
}
|
||||
safe_mode_state = PG(safe_mode);
|
||||
open_basedir = PG(open_basedir);
|
||||
|
||||
env_location = getenv("PHPRC");
|
||||
if (!env_location) {
|
||||
env_location="";
|
||||
}
|
||||
if (php_ini_path_override) {
|
||||
php_ini_search_path = php_ini_path_override;
|
||||
free_ini_search_path = 0;
|
||||
} else {
|
||||
char *default_location;
|
||||
int free_default_location;
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
{
|
||||
if (php_ini_path) {
|
||||
default_location = php_ini_path;
|
||||
} else {
|
||||
default_location = (char *) malloc(512);
|
||||
|
||||
if (!GetWindowsDirectory(default_location,255)) {
|
||||
default_location[0]=0;
|
||||
}
|
||||
free_default_location=1;
|
||||
}
|
||||
default_location = (char *) emalloc(512);
|
||||
|
||||
if (!GetWindowsDirectory(default_location,255)) {
|
||||
default_location[0]=0;
|
||||
}
|
||||
free_default_location=1;
|
||||
#else
|
||||
if (!php_ini_path) {
|
||||
default_location = CONFIGURATION_FILE_PATH;
|
||||
} else {
|
||||
default_location = php_ini_path;
|
||||
}
|
||||
default_location = CONFIGURATION_FILE_PATH;
|
||||
free_default_location=0;
|
||||
#endif
|
||||
|
||||
/* build a path */
|
||||
php_ini_search_path = (char *) malloc(sizeof(".")+strlen(env_location)+strlen(default_location)+2+1);
|
||||
|
||||
if (!php_ini_path) {
|
||||
#ifdef PHP_WIN32
|
||||
sprintf(php_ini_search_path,".;%s;%s",env_location,default_location);
|
||||
#else
|
||||
sprintf(php_ini_search_path,".:%s:%s",env_location,default_location);
|
||||
#endif
|
||||
} else {
|
||||
/* if path was set via -c flag, only look there */
|
||||
strcpy(php_ini_search_path,default_location);
|
||||
}
|
||||
PG(safe_mode) = 0;
|
||||
PG(open_basedir) = NULL;
|
||||
|
||||
|
||||
fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &opened_path);
|
||||
free(php_ini_search_path);
|
||||
php_ini_search_path = (char *) emalloc(sizeof(".")+strlen(env_location)+strlen(default_location)+2+1);
|
||||
free_ini_search_path = 1;
|
||||
sprintf(php_ini_search_path, ".%c%s%c%s", ZEND_PATHS_SEPARATOR, env_location, ZEND_PATHS_SEPARATOR, default_location);
|
||||
if (free_default_location) {
|
||||
free(default_location);
|
||||
}
|
||||
PG(safe_mode) = safe_mode_state;
|
||||
PG(open_basedir) = open_basedir;
|
||||
|
||||
if (!fh.handle.fp) {
|
||||
return SUCCESS; /* having no configuration file is ok */
|
||||
}
|
||||
fh.type = ZEND_HANDLE_FP;
|
||||
fh.filename = opened_path;
|
||||
|
||||
zend_parse_ini_file(&fh, 1, php_config_ini_parser_cb, NULL);
|
||||
|
||||
if (opened_path) {
|
||||
zval tmp;
|
||||
|
||||
tmp.value.str.val = strdup(opened_path);
|
||||
tmp.value.str.len = strlen(opened_path);
|
||||
tmp.type = IS_STRING;
|
||||
zend_hash_update(&configuration_hash,"cfg_file_path",sizeof("cfg_file_path"),(void *) &tmp,sizeof(zval),NULL);
|
||||
#if DEBUG_CFG_PARSER
|
||||
php_printf("INI file opened at '%s'\n",opened_path);
|
||||
#endif
|
||||
efree(opened_path);
|
||||
efree(default_location);
|
||||
}
|
||||
}
|
||||
|
||||
PG(safe_mode) = 0;
|
||||
PG(open_basedir) = NULL;
|
||||
|
||||
#endif
|
||||
fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path);
|
||||
if (free_ini_search_path) {
|
||||
efree(php_ini_search_path);
|
||||
}
|
||||
PG(safe_mode) = safe_mode_state;
|
||||
PG(open_basedir) = open_basedir;
|
||||
|
||||
if (!fh.handle.fp) {
|
||||
return SUCCESS; /* having no configuration file is ok */
|
||||
}
|
||||
fh.type = ZEND_HANDLE_FP;
|
||||
fh.filename = php_ini_opened_path;
|
||||
|
||||
zend_parse_ini_file(&fh, 1, php_config_ini_parser_cb, NULL);
|
||||
|
||||
if (php_ini_opened_path) {
|
||||
zval tmp;
|
||||
|
||||
tmp.value.str.len = strlen(php_ini_opened_path);
|
||||
tmp.value.str.val = zend_strndup(php_ini_opened_path, tmp.value.str.len);
|
||||
tmp.type = IS_STRING;
|
||||
zend_hash_update(&configuration_hash, "cfg_file_path", sizeof("cfg_file_path"),(void *) &tmp,sizeof(zval), NULL);
|
||||
persist_alloc(php_ini_opened_path);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -243,6 +227,9 @@ int php_init_config(void)
|
|||
int php_shutdown_config(void)
|
||||
{
|
||||
zend_hash_destroy(&configuration_hash);
|
||||
if (php_ini_opened_path) {
|
||||
efree(php_ini_opened_path);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "zend_ini.h"
|
||||
|
||||
int php_init_config(void);
|
||||
int php_init_config(char *php_ini_path_override);
|
||||
int php_shutdown_config(void);
|
||||
|
||||
#define PHP_INI_USER ZEND_INI_USER
|
||||
|
|
|
@ -368,7 +368,7 @@ php_ns_sapi_register_variables(zval *track_vars_array ELS_DC SLS_DC PLS_DC)
|
|||
|
||||
/* this structure is static (as in "it does not change") */
|
||||
|
||||
static sapi_module_struct sapi_module = {
|
||||
static sapi_module_struct aolserver_sapi_module = {
|
||||
"aolserver",
|
||||
"AOLserver",
|
||||
|
||||
|
@ -606,15 +606,15 @@ int Ns_ModuleInit(char *server, char *module)
|
|||
php_ns_context *ctx;
|
||||
|
||||
tsrm_startup(1, 1, 0, NULL);
|
||||
sapi_startup(&sapi_module);
|
||||
sapi_module.startup(&sapi_module);
|
||||
sapi_startup(&aolserver_sapi_module);
|
||||
sapi_module.startup(&aolserver_sapi_module);
|
||||
|
||||
/* TSRM is used to allocate a per-thread structure */
|
||||
ns_globals_id = ts_allocate_id(sizeof(ns_globals_struct), NULL, NULL);
|
||||
|
||||
/* the context contains data valid for all threads */
|
||||
ctx = malloc(sizeof *ctx);
|
||||
ctx->sapi_module = &sapi_module;
|
||||
ctx->sapi_module = &aolserver_sapi_module;
|
||||
ctx->ns_server = strdup(server);
|
||||
ctx->ns_module = strdup(module);
|
||||
|
||||
|
|
|
@ -249,7 +249,7 @@ static void sapi_apache_register_server_variables(zval *track_vars_array ELS_DC
|
|||
|
||||
static int php_apache_startup(sapi_module_struct *sapi_module)
|
||||
{
|
||||
if(php_module_startup(sapi_module) == FAILURE
|
||||
if(php_module_startup(sapi_module, NULL) == FAILURE
|
||||
|| zend_startup_module(&apache_module_entry) == FAILURE) {
|
||||
return FAILURE;
|
||||
} else {
|
||||
|
@ -320,7 +320,7 @@ static char *php_apache_getenv(char *name, size_t name_len SLS_DC)
|
|||
}
|
||||
|
||||
|
||||
static sapi_module_struct sapi_module_conf = {
|
||||
static sapi_module_struct apache_sapi_module = {
|
||||
"apache", /* name */
|
||||
"Apache", /* pretty name */
|
||||
|
||||
|
@ -590,8 +590,8 @@ CONST_PREFIX char *php_apache_value_handler_ex(cmd_parms *cmd, HashTable *conf,
|
|||
#ifdef ZTS
|
||||
tsrm_startup(1, 1, 0, NULL);
|
||||
#endif
|
||||
sapi_startup(&sapi_module_conf);
|
||||
php_apache_startup(&sapi_module_conf);
|
||||
sapi_startup(&apache_sapi_module);
|
||||
php_apache_startup(&apache_sapi_module);
|
||||
}
|
||||
per_dir_entry.type = mode;
|
||||
|
||||
|
@ -675,7 +675,7 @@ int php_xbithack_handler(request_rec * r)
|
|||
static void apache_php_module_shutdown_wrapper(void)
|
||||
{
|
||||
apache_php_initialized = 0;
|
||||
sapi_module_conf.shutdown(&sapi_module_conf);
|
||||
apache_sapi_module.shutdown(&apache_sapi_module);
|
||||
|
||||
#if MODULE_MAGIC_NUMBER >= 19970728
|
||||
/* This function is only called on server exit if the apache API
|
||||
|
@ -693,7 +693,7 @@ static void apache_php_module_shutdown_wrapper(void)
|
|||
static void php_child_exit_handler(server_rec *s, pool *p)
|
||||
{
|
||||
/* apache_php_initialized = 0; */
|
||||
sapi_module_conf.shutdown(&sapi_module_conf);
|
||||
apache_sapi_module.shutdown(&apache_sapi_module);
|
||||
|
||||
#ifdef ZTS
|
||||
tsrm_shutdown();
|
||||
|
@ -709,8 +709,8 @@ void php_init_handler(server_rec *s, pool *p)
|
|||
#ifdef ZTS
|
||||
tsrm_startup(1, 1, 0, NULL);
|
||||
#endif
|
||||
sapi_startup(&sapi_module_conf);
|
||||
php_apache_startup(&sapi_module_conf);
|
||||
sapi_startup(&apache_sapi_module);
|
||||
php_apache_startup(&apache_sapi_module);
|
||||
}
|
||||
#if MODULE_MAGIC_NUMBER >= 19980527
|
||||
{
|
||||
|
|
|
@ -187,7 +187,7 @@ static void php_apache_sapi_log_message(char *msg)
|
|||
apr_puts(msg, ctx->f->r->server->error_log);
|
||||
}
|
||||
|
||||
static sapi_module_struct sapi_module = {
|
||||
static sapi_module_struct apache2_sapi_module = {
|
||||
"apache2filter",
|
||||
"Apache 2.0 Filter",
|
||||
|
||||
|
@ -420,7 +420,7 @@ ok:
|
|||
static apr_status_t
|
||||
php_apache_server_shutdown(void *tmp)
|
||||
{
|
||||
sapi_module.shutdown(&sapi_module);
|
||||
apache2_sapi_module.shutdown(&apache2_sapi_module);
|
||||
sapi_shutdown();
|
||||
tsrm_shutdown();
|
||||
return APR_SUCCESS;
|
||||
|
@ -430,8 +430,8 @@ static void
|
|||
php_apache_server_startup(apr_pool_t *pchild, server_rec *s)
|
||||
{
|
||||
tsrm_startup(1, 1, 0, NULL);
|
||||
sapi_startup(&sapi_module);
|
||||
sapi_module.startup(&sapi_module);
|
||||
sapi_startup(&apache1_sapi_module);
|
||||
apache2_sapi_module.startup(&apache2_sapi_module);
|
||||
apr_register_cleanup(pchild, NULL, php_apache_server_shutdown, NULL);
|
||||
php_apache_register_module();
|
||||
}
|
||||
|
|
|
@ -491,7 +491,7 @@ static zend_module_entry php_caudium_module = {
|
|||
|
||||
|
||||
/* this structure is static (as in "it does not change") */
|
||||
static sapi_module_struct sapi_module = {
|
||||
static sapi_module_struct caudium_sapi_module = {
|
||||
"caudium",
|
||||
"Caudium",
|
||||
php_module_startup, /* startup */
|
||||
|
@ -781,8 +781,8 @@ void pike_module_init( void )
|
|||
caudium_php_initialized = 1;
|
||||
tsrm_startup(1, 1, 0, NULL);
|
||||
caudium_globals_id = ts_allocate_id(sizeof(php_caudium_request), NULL, NULL);
|
||||
sapi_startup(&sapi_module);
|
||||
sapi_module.startup(&sapi_module);
|
||||
sapi_startup(&caudium_sapi_module);
|
||||
sapi_module.startup(&caudium_sapi_module);
|
||||
zend_startup_module(&php_caudium_module);
|
||||
PHP_INIT_LOCK();
|
||||
}
|
||||
|
@ -800,7 +800,7 @@ void pike_module_init( void )
|
|||
void pike_module_exit(void)
|
||||
{
|
||||
caudium_php_initialized = 0;
|
||||
sapi_module.shutdown(&sapi_module);
|
||||
sapi_module.shutdown(&caudium_sapi_module);
|
||||
if(php_program) free_program(php_program);
|
||||
tsrm_shutdown();
|
||||
PHP_DESTROY();
|
||||
|
|
|
@ -75,8 +75,6 @@
|
|||
|
||||
#include "php_getopt.h"
|
||||
|
||||
PHPAPI extern char *php_ini_path;
|
||||
|
||||
#define PHP_MODE_STANDARD 1
|
||||
#define PHP_MODE_HIGHLIGHT 2
|
||||
#define PHP_MODE_INDENT 3
|
||||
|
@ -201,7 +199,7 @@ static int sapi_cgi_deactivate(SLS_D)
|
|||
|
||||
|
||||
|
||||
static sapi_module_struct sapi_module = {
|
||||
static sapi_module_struct cgi_sapi_module = {
|
||||
"cgi", /* name */
|
||||
"CGI", /* pretty name */
|
||||
|
||||
|
@ -412,7 +410,7 @@ int main(int argc, char *argv[])
|
|||
tsrm_startup(1,1,0, NULL);
|
||||
#endif
|
||||
|
||||
sapi_startup(&sapi_module);
|
||||
sapi_startup(&cgi_sapi_module);
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
_fmode = _O_BINARY; /*sets default for file streams to binary */
|
||||
|
@ -468,7 +466,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
|
|||
while ((c=ap_php_getopt(argc, argv, OPTSTRING))!=-1) {
|
||||
switch (c) {
|
||||
case 'c':
|
||||
php_ini_path = strdup(ap_php_optarg); /* intentional leak */
|
||||
cgi_sapi_module.php_ini_path_override = strdup(ap_php_optarg);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -477,7 +475,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
|
|||
ap_php_optarg = orig_optarg;
|
||||
}
|
||||
|
||||
if (php_module_startup(&sapi_module)==FAILURE) {
|
||||
if (php_module_startup(&cgi_sapi_module)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
#ifdef ZTS
|
||||
|
@ -773,6 +771,9 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
|
|||
|
||||
STR_FREE(SG(request_info).path_translated);
|
||||
|
||||
if (cgi_sapi_module.php_ini_path_override) {
|
||||
free(cgi_sapi_module.php_ini_path_override);
|
||||
}
|
||||
#ifdef ZTS
|
||||
tsrm_shutdown();
|
||||
#endif
|
||||
|
|
|
@ -50,11 +50,56 @@
|
|||
static zend_bool bFilterLoaded=0;
|
||||
static zend_bool bTerminateThreadsOnError=0;
|
||||
|
||||
static char *isapi_server_variables[] = {
|
||||
static char *isapi_special_server_variable_names[] = {
|
||||
"ALL_HTTP",
|
||||
"HTTPS",
|
||||
#ifndef WITH_ZEUS
|
||||
"SCRIPT_NAME",
|
||||
#else
|
||||
"PATH_INFO",
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
#define NUM_SPECIAL_VARS (sizeof(isapi_special_server_variable_names)/sizeof(char *))
|
||||
#define SPECIAL_VAR_ALL_HTTP 0
|
||||
#define SPECIAL_VAR_HTTPS 1
|
||||
#define SPECIAL_VAR_PHP_SELF 2
|
||||
|
||||
static char *isapi_special_server_variables[NUM_SPECIAL_VARS];
|
||||
|
||||
static char *isapi_server_variable_names[] = {
|
||||
"AUTH_PASSWORD",
|
||||
"AUTH_TYPE",
|
||||
"AUTH_USER",
|
||||
"CONTENT_LENGTH",
|
||||
"CONTENT_TYPE",
|
||||
"PATH_TRANSLATED",
|
||||
"QUERY_STRING",
|
||||
"REMOTE_ADDR",
|
||||
"REMOTE_HOST",
|
||||
"REMOTE_USER",
|
||||
"REQUEST_METHOD",
|
||||
"SERVER_NAME",
|
||||
"SERVER_PORT",
|
||||
"SERVER_PROTOCOL",
|
||||
"SERVER_SOFTWARE",
|
||||
#ifndef WITH_ZEUS
|
||||
"APPL_MD_PATH",
|
||||
"APPL_PHYSICAL_PATH",
|
||||
"INSTANCE_ID",
|
||||
"INSTANCE_META_PATH",
|
||||
"LOGON_USER",
|
||||
"REQUEST_URI",
|
||||
"URL",
|
||||
#else
|
||||
"DOCUMENT_ROOT",
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
static char *isapi_secure_server_variable_names[] = {
|
||||
"CERT_COOKIE",
|
||||
"CERT_FLAGS",
|
||||
"CERT_ISSUER",
|
||||
|
@ -64,47 +109,27 @@ static char *isapi_server_variables[] = {
|
|||
"CERT_SERVER_ISSUER",
|
||||
"CERT_SERVER_SUBJECT",
|
||||
"CERT_SUBJECT",
|
||||
"CONTENT_LENGTH",
|
||||
"CONTENT_TYPE",
|
||||
"HTTP_COOKIE",
|
||||
"HTTPS_KEYSIZE",
|
||||
"HTTPS_SECRETKEYSIZE",
|
||||
"HTTPS_SERVER_ISSUER",
|
||||
"HTTPS_SERVER_SUBJECT",
|
||||
"HTTPS",
|
||||
"PATH_TRANSLATED",
|
||||
"QUERY_STRING",
|
||||
"REMOTE_ADDR",
|
||||
"REMOTE_HOST",
|
||||
"REMOTE_USER",
|
||||
"REQUEST_METHOD",
|
||||
"SERVER_NAME",
|
||||
"SERVER_PORT",
|
||||
"SERVER_PORT_SECURE",
|
||||
"SERVER_PROTOCOL",
|
||||
"SERVER_SOFTWARE",
|
||||
#ifndef WITH_ZEUS
|
||||
"APPL_MD_PATH",
|
||||
"APPL_PHYSICAL_PATH",
|
||||
"INSTANCE_ID",
|
||||
"INSTANCE_META_PATH",
|
||||
"LOGON_USER",
|
||||
"PATH_INFO",
|
||||
"REQUEST_URI",
|
||||
"SCRIPT_NAME",
|
||||
"URL",
|
||||
#else
|
||||
"DOCUMENT_ROOT",
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
static void php_info_isapi(ZEND_MODULE_INFO_FUNC_ARGS)
|
||||
{
|
||||
char **p = isapi_server_variables;
|
||||
char **p;
|
||||
char variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
|
||||
DWORD variable_len;
|
||||
char **all_variables[] = {
|
||||
isapi_server_variable_names,
|
||||
isapi_special_server_variable_names,
|
||||
isapi_secure_server_variable_names,
|
||||
NULL
|
||||
};
|
||||
char ***server_variable_names;
|
||||
LPEXTENSION_CONTROL_BLOCK lpECB;
|
||||
SLS_FETCH();
|
||||
|
||||
|
@ -112,22 +137,27 @@ static void php_info_isapi(ZEND_MODULE_INFO_FUNC_ARGS)
|
|||
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_header(2, "Server Variable", "Value");
|
||||
while (*p) {
|
||||
variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
|
||||
if (lpECB->GetServerVariable(lpECB->ConnID, *p, variable_buf, &variable_len)
|
||||
&& variable_buf[0]) {
|
||||
php_info_print_table_row(2, *p, variable_buf);
|
||||
} else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
|
||||
char *tmp_variable_buf;
|
||||
|
||||
tmp_variable_buf = (char *) emalloc(variable_len);
|
||||
if (lpECB->GetServerVariable(lpECB->ConnID, *p, tmp_variable_buf, &variable_len)
|
||||
server_variable_names = all_variables;
|
||||
while (*server_variable_names) {
|
||||
p = *server_variable_names;
|
||||
while (*p) {
|
||||
variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
|
||||
if (lpECB->GetServerVariable(lpECB->ConnID, *p, variable_buf, &variable_len)
|
||||
&& variable_buf[0]) {
|
||||
php_info_print_table_row(2, *p, tmp_variable_buf);
|
||||
php_info_print_table_row(2, *p, variable_buf);
|
||||
} else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
|
||||
char *tmp_variable_buf;
|
||||
|
||||
tmp_variable_buf = (char *) emalloc(variable_len);
|
||||
if (lpECB->GetServerVariable(lpECB->ConnID, *p, tmp_variable_buf, &variable_len)
|
||||
&& variable_buf[0]) {
|
||||
php_info_print_table_row(2, *p, tmp_variable_buf);
|
||||
}
|
||||
efree(tmp_variable_buf);
|
||||
}
|
||||
efree(tmp_variable_buf);
|
||||
p++;
|
||||
}
|
||||
p++;
|
||||
server_variable_names++;
|
||||
}
|
||||
php_info_print_table_end();
|
||||
}
|
||||
|
@ -304,38 +334,15 @@ static char *sapi_isapi_read_cookies(SLS_D)
|
|||
}
|
||||
|
||||
|
||||
static void sapi_isapi_register_server_variables(zval *track_vars_array ELS_DC SLS_DC PLS_DC)
|
||||
#ifdef WITH_ZEUS
|
||||
static void sapi_isapi_register_zeus_variables(LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array ELS_DC PLS_DC)
|
||||
{
|
||||
char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
|
||||
char *variable_buf;
|
||||
DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
|
||||
char *variable;
|
||||
char *strtok_buf = NULL;
|
||||
LPEXTENSION_CONTROL_BLOCK lpECB;
|
||||
char **p = isapi_server_variables;
|
||||
|
||||
lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
|
||||
|
||||
/* Register the standard ISAPI variables */
|
||||
while (*p) {
|
||||
variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
|
||||
if (lpECB->GetServerVariable(lpECB->ConnID, *p, static_variable_buf, &variable_len)
|
||||
&& static_variable_buf[0]) {
|
||||
php_register_variable(*p, static_variable_buf, track_vars_array ELS_CC PLS_CC);
|
||||
} else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
|
||||
variable_buf = (char *) emalloc(variable_len);
|
||||
if (lpECB->GetServerVariable(lpECB->ConnID, *p, variable_buf, &variable_len)
|
||||
&& variable_buf[0]) {
|
||||
php_register_variable(*p, variable_buf, track_vars_array ELS_CC PLS_CC);
|
||||
}
|
||||
efree(variable_buf);
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
#ifdef WITH_ZEUS
|
||||
/*
|
||||
* Zeus' map module translates the given URL onto the PHP ISAPI libray;
|
||||
* Zeus' map module translates the given URL onto the PHP ISAPI library;
|
||||
* from an internal point of view, SCRIPT_NAME and URL are correct,
|
||||
* but from the end-users point of view, it is not... We need to
|
||||
* reconstruct the SCRIPT_NAME and URL from PATH_INFO, and then
|
||||
|
@ -359,51 +366,98 @@ static void sapi_isapi_register_server_variables(zval *track_vars_array ELS_DC S
|
|||
if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_TRANSLATED", static_variable_buf, &variable_len) && static_variable_buf[0] ) {
|
||||
php_register_variable( "SCRIPT_FILENAME", static_variable_buf, track_vars_array ELS_CC PLS_CC );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void sapi_isapi_register_server_variables2(char **server_variables, LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array, char **recorded_values ELS_DC PLS_DC)
|
||||
{
|
||||
char **p=server_variables;
|
||||
DWORD variable_len;
|
||||
char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
|
||||
char *variable_buf;
|
||||
|
||||
while (*p) {
|
||||
variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
|
||||
if (lpECB->GetServerVariable(lpECB->ConnID, *p, static_variable_buf, &variable_len)
|
||||
&& static_variable_buf[0]) {
|
||||
php_register_variable(*p, static_variable_buf, track_vars_array ELS_CC PLS_CC);
|
||||
if (recorded_values) {
|
||||
recorded_values[p-server_variables] = estrndup(static_variable_buf, variable_len);
|
||||
}
|
||||
} else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
|
||||
variable_buf = (char *) emalloc(variable_len);
|
||||
if (lpECB->GetServerVariable(lpECB->ConnID, *p, variable_buf, &variable_len)
|
||||
&& variable_buf[0]) {
|
||||
php_register_variable(*p, variable_buf, track_vars_array ELS_CC PLS_CC);
|
||||
}
|
||||
if (recorded_values) {
|
||||
recorded_values[p-server_variables] = variable_buf;
|
||||
} else {
|
||||
efree(variable_buf);
|
||||
}
|
||||
}
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void sapi_isapi_register_server_variables(zval *track_vars_array ELS_DC SLS_DC PLS_DC)
|
||||
{
|
||||
DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
|
||||
char *variable;
|
||||
char *strtok_buf = NULL;
|
||||
LPEXTENSION_CONTROL_BLOCK lpECB;
|
||||
|
||||
lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
|
||||
|
||||
/* Register the special ISAPI variables */
|
||||
memset(isapi_special_server_variables, 0, sizeof(isapi_special_server_variables));
|
||||
sapi_isapi_register_server_variables2(isapi_special_server_variable_names, lpECB, track_vars_array, isapi_special_server_variables ELS_CC PLS_CC);
|
||||
if (SG(request_info).cookie_data) {
|
||||
php_register_variable("HTTP_COOKIE", SG(request_info).cookie_data, track_vars_array ELS_CC PLS_CC);
|
||||
}
|
||||
|
||||
/* Register the standard ISAPI variables */
|
||||
sapi_isapi_register_server_variables2(isapi_server_variable_names, lpECB, track_vars_array, NULL ELS_CC PLS_CC);
|
||||
|
||||
if (isapi_special_server_variables[SPECIAL_VAR_HTTPS]
|
||||
&& atoi(isapi_special_server_variables[SPECIAL_VAR_HTTPS])) {
|
||||
/* Register SSL ISAPI variables */
|
||||
sapi_isapi_register_server_variables2(isapi_secure_server_variable_names, lpECB, track_vars_array, NULL ELS_CC PLS_CC);
|
||||
}
|
||||
efree(isapi_special_server_variables[SPECIAL_VAR_HTTPS]);
|
||||
|
||||
|
||||
#ifdef WITH_ZEUS
|
||||
sapi_isapi_register_zeus_variables(lpECB, track_vars_array ELS_CC PLS_CC);
|
||||
#endif
|
||||
|
||||
/* PHP_SELF support */
|
||||
variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
|
||||
#ifdef WITH_ZEUS
|
||||
if (lpECB->GetServerVariable(lpECB->ConnID, "PATH_INFO", static_variable_buf, &variable_len)
|
||||
#else
|
||||
if (lpECB->GetServerVariable(lpECB->ConnID, "SCRIPT_NAME", static_variable_buf, &variable_len)
|
||||
#endif
|
||||
&& static_variable_buf[0]) {
|
||||
php_register_variable("PHP_SELF", static_variable_buf, track_vars_array ELS_CC PLS_CC);
|
||||
if (isapi_special_server_variables[SPECIAL_VAR_PHP_SELF]) {
|
||||
php_register_variable("PHP_SELF", isapi_special_server_variables[SPECIAL_VAR_PHP_SELF], track_vars_array ELS_CC PLS_CC);
|
||||
efree(isapi_special_server_variables[SPECIAL_VAR_PHP_SELF]);
|
||||
}
|
||||
|
||||
/* Register the internal bits of ALL_HTTP */
|
||||
if (isapi_special_server_variables[SPECIAL_VAR_ALL_HTTP]) {
|
||||
/* Register the internal bits of ALL_HTTP */
|
||||
variable = php_strtok_r(isapi_special_server_variables[SPECIAL_VAR_ALL_HTTP], "\r\n", &strtok_buf);
|
||||
while (variable) {
|
||||
char *colon = strchr(variable, ':');
|
||||
|
||||
variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
|
||||
if (colon) {
|
||||
char *value = colon+1;
|
||||
|
||||
if (lpECB->GetServerVariable(lpECB->ConnID, "ALL_HTTP", static_variable_buf, &variable_len)) {
|
||||
variable_buf = static_variable_buf;
|
||||
} else {
|
||||
if (GetLastError()==ERROR_INSUFFICIENT_BUFFER) {
|
||||
variable_buf = (char *) emalloc(variable_len);
|
||||
if (!lpECB->GetServerVariable(lpECB->ConnID, "ALL_HTTP", variable_buf, &variable_len)) {
|
||||
efree(variable_buf);
|
||||
return;
|
||||
while (*value==' ') {
|
||||
value++;
|
||||
}
|
||||
*colon = 0;
|
||||
php_register_variable(variable, value, track_vars_array ELS_CC PLS_CC);
|
||||
*colon = ':';
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
variable = php_strtok_r(NULL, "\r\n", &strtok_buf);
|
||||
}
|
||||
}
|
||||
variable = php_strtok_r(variable_buf, "\r\n", &strtok_buf);
|
||||
while (variable) {
|
||||
char *colon = strchr(variable, ':');
|
||||
|
||||
if (colon) {
|
||||
char *value = colon+1;
|
||||
|
||||
while (*value==' ') {
|
||||
value++;
|
||||
}
|
||||
*colon = 0;
|
||||
php_register_variable(variable, value, track_vars_array ELS_CC PLS_CC);
|
||||
*colon = ':';
|
||||
}
|
||||
variable = php_strtok_r(NULL, "\r\n", &strtok_buf);
|
||||
efree(isapi_special_server_variables[SPECIAL_VAR_ALL_HTTP]);
|
||||
}
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
|
@ -421,14 +475,10 @@ static void sapi_isapi_register_server_variables(zval *track_vars_array ELS_DC S
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (variable_buf!=static_variable_buf) {
|
||||
efree(variable_buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static sapi_module_struct sapi_module = {
|
||||
static sapi_module_struct isapi_sapi_module = {
|
||||
"isapi", /* name */
|
||||
"ISAPI", /* pretty name */
|
||||
|
||||
|
@ -466,7 +516,7 @@ BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pFilterVersion)
|
|||
{
|
||||
bFilterLoaded = 1;
|
||||
pFilterVersion->dwFilterVersion = HTTP_FILTER_REVISION;
|
||||
strcpy(pFilterVersion->lpszFilterDesc, sapi_module.pretty_name);
|
||||
strcpy(pFilterVersion->lpszFilterDesc, isapi_sapi_module.pretty_name);
|
||||
pFilterVersion->dwFlags= (SF_NOTIFY_AUTHENTICATION | SF_NOTIFY_PREPROC_HEADERS);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -537,9 +587,9 @@ BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer)
|
|||
{
|
||||
pVer->dwExtensionVersion = HSE_VERSION;
|
||||
#ifdef WITH_ZEUS
|
||||
strncpy( pVer->lpszExtensionDesc, sapi_module.name, HSE_MAX_EXT_DLL_NAME_LEN);
|
||||
strncpy( pVer->lpszExtensionDesc, isapi_sapi_module.name, HSE_MAX_EXT_DLL_NAME_LEN);
|
||||
#else
|
||||
lstrcpyn(pVer->lpszExtensionDesc, sapi_module.name, HSE_MAX_EXT_DLL_NAME_LEN);
|
||||
lstrcpyn(pVer->lpszExtensionDesc, isapi_sapi_module.name, HSE_MAX_EXT_DLL_NAME_LEN);
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -661,9 +711,9 @@ __declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, L
|
|||
switch (fdwReason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
tsrm_startup(1, 1, TSRM_ERROR_LEVEL_CORE, "C:\\TSRM.log");
|
||||
sapi_startup(&sapi_module);
|
||||
if (sapi_module.startup) {
|
||||
sapi_module.startup(&sapi_module);
|
||||
sapi_startup(&isapi_sapi_module);
|
||||
if (isapi_sapi_module.startup) {
|
||||
isapi_sapi_module.startup(&sapi_module);
|
||||
}
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
|
@ -672,8 +722,8 @@ __declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, L
|
|||
ts_free_thread();
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
if (sapi_module.shutdown) {
|
||||
sapi_module.shutdown(&sapi_module);
|
||||
if (isapi_sapi_module.shutdown) {
|
||||
isapi_sapi_module.shutdown(&sapi_module);
|
||||
}
|
||||
tsrm_shutdown();
|
||||
break;
|
||||
|
|
|
@ -320,7 +320,7 @@ sapi_nsapi_register_server_variables(zval *track_vars_array ELS_DC SLS_DC PLS_DC
|
|||
}
|
||||
}
|
||||
|
||||
static sapi_module_struct sapi_module = {
|
||||
static sapi_module_struct nsapi_sapi_module = {
|
||||
"nsapi", /* name */
|
||||
"NSAPI", /* pretty name */
|
||||
|
||||
|
@ -531,8 +531,8 @@ nsapi_module_main(NSLS_D SLS_DC)
|
|||
void NSAPI_PUBLIC
|
||||
php4_close(void *vparam)
|
||||
{
|
||||
if (sapi_module.shutdown) {
|
||||
sapi_module.shutdown(&sapi_module);
|
||||
if (nsapi_sapi_module.shutdown) {
|
||||
nsapi_sapi_module.shutdown(&nsapi_sapi_module);
|
||||
}
|
||||
tsrm_shutdown();
|
||||
}
|
||||
|
@ -545,8 +545,8 @@ php4_init(pblock *pb, Session *sn, Request *rq)
|
|||
tsrm_startup(1, 1, 0, NULL);
|
||||
core_globals = ts_resource(core_globals_id);
|
||||
|
||||
sapi_startup(&sapi_module);
|
||||
sapi_module.startup(&sapi_module);
|
||||
sapi_startup(&nsapi_sapi_module);
|
||||
nsapi_sapi_module.startup(&nsapi_sapi_module);
|
||||
|
||||
log_error(LOG_INFORM, "php4_init", sn, rq, "Initialized PHP Module\n");
|
||||
return REQ_PROCEED;
|
||||
|
|
|
@ -163,7 +163,7 @@ php_phttpd_sapi_read_post(char *buf, uint count_bytes SLS_DC)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static sapi_module_struct sapi_module = {
|
||||
static sapi_module_struct phttpd_sapi_module = {
|
||||
"phttpd",
|
||||
"PHTTPD",
|
||||
|
||||
|
@ -284,8 +284,8 @@ int php_doit(PHLS_D SLS_DC)
|
|||
int pm_init(const char **argv)
|
||||
{
|
||||
tsrm_startup(1, 1, 0, NULL);
|
||||
sapi_startup(&sapi_module);
|
||||
sapi_module.startup(&sapi_module);
|
||||
sapi_startup(&phttpd_sapi_module);
|
||||
phttpd_sapi_module.startup(&phttpd_sapi_module);
|
||||
|
||||
ph_globals_id = ts_allocate_id(sizeof(phttpd_globals_struct), NULL, NULL);
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ static char *sapi_pi3web_read_cookies(SLS_D)
|
|||
}
|
||||
|
||||
|
||||
static sapi_module_struct sapi_module = {
|
||||
static sapi_module_struct pi3web_sapi_module = {
|
||||
"pi3web", /* name */
|
||||
"PI3WEB", /* pretty name */
|
||||
|
||||
|
@ -428,17 +428,17 @@ DWORD fnWrapperProc(LPCONTROL_BLOCK lpCB)
|
|||
|
||||
BOOL PHP4_startup() {
|
||||
tsrm_startup(1, 1, 0, NULL);
|
||||
sapi_startup(&sapi_module);
|
||||
if (sapi_module.startup) {
|
||||
sapi_module.startup(&sapi_module);
|
||||
sapi_startup(&pi3web_sapi_module);
|
||||
if (pi3web_sapi_module.startup) {
|
||||
pi3web_sapi_module.startup(&pi3web_sapi_module);
|
||||
};
|
||||
IWasLoaded = 1;
|
||||
return IWasLoaded;
|
||||
};
|
||||
|
||||
BOOL PHP4_shutdown() {
|
||||
if (sapi_module.shutdown) {
|
||||
sapi_module.shutdown(&sapi_module);
|
||||
if (pi3web_sapi_module.shutdown) {
|
||||
pi3web_sapi_module.shutdown(&pi3web_sapi_module);
|
||||
};
|
||||
sapi_shutdown();
|
||||
tsrm_shutdown();
|
||||
|
|
|
@ -489,7 +489,7 @@ static int php_roxen_startup(sapi_module_struct *sapi_module)
|
|||
|
||||
/* this structure is static (as in "it does not change") */
|
||||
|
||||
static sapi_module_struct sapi_module = {
|
||||
static sapi_module_struct roxen_sapi_module = {
|
||||
"roxen",
|
||||
"Roxen",
|
||||
php_module_startup, /* startup */
|
||||
|
@ -708,8 +708,8 @@ void pike_module_init( void )
|
|||
roxen_globals_id = ts_allocate_id(sizeof(php_roxen_request), NULL, NULL);
|
||||
#endif
|
||||
#endif
|
||||
sapi_startup(&sapi_module);
|
||||
php_roxen_startup(&sapi_module);
|
||||
sapi_startup(&roxen_sapi_module);
|
||||
php_roxen_startup(&roxen_sapi_module);
|
||||
roxen_php_initialized = 1;
|
||||
PHP_INIT_LOCK();
|
||||
}
|
||||
|
@ -729,7 +729,7 @@ void pike_module_init( void )
|
|||
void pike_module_exit(void)
|
||||
{
|
||||
roxen_php_initialized = 0;
|
||||
sapi_module.shutdown(&sapi_module);
|
||||
roxen_sapi_module.shutdown(&roxen_sapi_module);
|
||||
if(php_program) free_program(php_program);
|
||||
#ifdef ZTS
|
||||
tsrm_shutdown();
|
||||
|
|
|
@ -65,8 +65,6 @@
|
|||
#include "zend_highlight.h"
|
||||
#include "zend_indent.h"
|
||||
|
||||
PHPAPI extern char *php_ini_path;
|
||||
|
||||
JNIEXPORT void JNICALL Java_net_php_reflect_setEnv
|
||||
(JNIEnv *newJenv, jclass self);
|
||||
|
||||
|
@ -216,7 +214,7 @@ static char *sapi_servlet_read_cookies(SLS_D)
|
|||
* sapi maintenance
|
||||
*/
|
||||
|
||||
static sapi_module_struct sapi_module = {
|
||||
static sapi_module_struct servlet_sapi_module = {
|
||||
"java_servlet", /* name */
|
||||
"Java Servlet", /* pretty name */
|
||||
|
||||
|
@ -263,9 +261,9 @@ JNIEXPORT void JNICALL Java_net_php_servlet_startup
|
|||
}
|
||||
#endif
|
||||
|
||||
sapi_startup(&sapi_module);
|
||||
sapi_startup(&servlet_sapi_module);
|
||||
|
||||
if (php_module_startup(&sapi_module)==FAILURE) {
|
||||
if (php_module_startup(&servlet_sapi_module)==FAILURE) {
|
||||
ThrowServletException(jenv,"module startup failure");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ static void sapi_thttpd_register_variables(zval *track_vars_array ELS_DC SLS_DC
|
|||
php_register_variable("AUTH_TYPE", "Basic", track_vars_array ELS_CC PLS_C);
|
||||
}
|
||||
|
||||
static sapi_module_struct sapi_module = {
|
||||
static sapi_module_struct thttpd_sapi_module = {
|
||||
"thttpd",
|
||||
"thttpd",
|
||||
|
||||
|
@ -306,15 +306,15 @@ void thttpd_set_dont_close(void)
|
|||
|
||||
void thttpd_php_init(void)
|
||||
{
|
||||
sapi_startup(&sapi_module);
|
||||
sapi_module.startup(&sapi_module);
|
||||
sapi_startup(&thttpd_sapi_module);
|
||||
thttpd_sapi_module.startup(&thttpd_sapi_module);
|
||||
SG(server_context) = (void *) 1;
|
||||
}
|
||||
|
||||
void thttpd_php_shutdown(void)
|
||||
{
|
||||
if (SG(server_context) != NULL) {
|
||||
sapi_module.shutdown(&sapi_module);
|
||||
thttpd_sapi_module.shutdown(&thttpd_sapi_module);
|
||||
sapi_shutdown();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue