|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 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)
#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)
{
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" );
}
/* 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, ...);
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,
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);
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 */
/* True globals (no need for thread safety) */
HashTable configuration_hash;
-PHPAPI char *php_ini_path = NULL;
-
#define SAFE_FILENAME(f) ((f)?(f):"-")
}
}
-
-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)
{
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;
}
#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)
}
-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="";
- }
-#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;
- }
- }
-#else
- if (!php_ini_path) {
- default_location = CONFIGURATION_FILE_PATH;
- } else {
- default_location = php_ini_path;
- }
-#endif
+ safe_mode_state = PG(safe_mode);
+ open_basedir = PG(open_basedir);
-/* build a path */
- php_ini_search_path = (char *) malloc(sizeof(".")+strlen(env_location)+strlen(default_location)+2+1);
+ 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;
- if (!php_ini_path) {
#ifdef PHP_WIN32
- sprintf(php_ini_search_path,".;%s;%s",env_location,default_location);
+ default_location = (char *) emalloc(512);
+
+ if (!GetWindowsDirectory(default_location,255)) {
+ default_location[0]=0;
+ }
+ free_default_location=1;
#else
- sprintf(php_ini_search_path,".:%s:%s",env_location,default_location);
+ default_location = CONFIGURATION_FILE_PATH;
+ free_default_location=0;
#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;
}
int php_shutdown_config(void)
{
zend_hash_destroy(&configuration_hash);
+ if (php_ini_opened_path) {
+ efree(php_ini_opened_path);
+ }
return SUCCESS;
}
#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
/* 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",
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);
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 {
}
-static sapi_module_struct sapi_module_conf = {
+static sapi_module_struct apache_sapi_module = {
"apache", /* name */
"Apache", /* pretty name */
#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;
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
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();
#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
{
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",
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;
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();
}
/* 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 */
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();
}
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();
#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
-static sapi_module_struct sapi_module = {
+static sapi_module_struct cgi_sapi_module = {
"cgi", /* name */
"CGI", /* pretty name */
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 */
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;
}
ap_php_optarg = orig_optarg;
}
- if (php_module_startup(&sapi_module)==FAILURE) {
+ if (php_module_startup(&cgi_sapi_module)==FAILURE) {
return FAILURE;
}
#ifdef ZTS
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
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",
- "CERT_COOKIE",
- "CERT_FLAGS",
- "CERT_ISSUER",
- "CERT_KEYSIZE",
- "CERT_SECRETKEYSIZE",
- "CERT_SERIALNUMBER",
- "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",
"REQUEST_METHOD",
"SERVER_NAME",
"SERVER_PORT",
- "SERVER_PORT_SECURE",
"SERVER_PROTOCOL",
"SERVER_SOFTWARE",
#ifndef WITH_ZEUS
"INSTANCE_ID",
"INSTANCE_META_PATH",
"LOGON_USER",
- "PATH_INFO",
"REQUEST_URI",
- "SCRIPT_NAME",
"URL",
#else
"DOCUMENT_ROOT",
};
+static char *isapi_secure_server_variable_names[] = {
+ "CERT_COOKIE",
+ "CERT_FLAGS",
+ "CERT_ISSUER",
+ "CERT_KEYSIZE",
+ "CERT_SECRETKEYSIZE",
+ "CERT_SERIALNUMBER",
+ "CERT_SERVER_ISSUER",
+ "CERT_SERVER_SUBJECT",
+ "CERT_SUBJECT",
+ "HTTPS_KEYSIZE",
+ "HTTPS_SECRETKEYSIZE",
+ "HTTPS_SERVER_ISSUER",
+ "HTTPS_SERVER_SUBJECT",
+ "SERVER_PORT_SECURE",
+ 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();
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();
}
}
-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
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
- /* 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);
- }
-
- /* Register the internal bits of ALL_HTTP */
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
+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;
- if (lpECB->GetServerVariable(lpECB->ConnID, "ALL_HTTP", static_variable_buf, &variable_len)) {
- variable_buf = static_variable_buf;
- } else {
- if (GetLastError()==ERROR_INSUFFICIENT_BUFFER) {
+ 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, "ALL_HTTP", variable_buf, &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);
- return;
}
- } else {
- return;
}
+ 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 */
+ 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]);
}
- variable = php_strtok_r(variable_buf, "\r\n", &strtok_buf);
- while (variable) {
- char *colon = strchr(variable, ':');
- if (colon) {
- char *value = colon+1;
+ 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, ':');
- while (*value==' ') {
- value++;
+ if (colon) {
+ char *value = colon+1;
+
+ while (*value==' ') {
+ value++;
+ }
+ *colon = 0;
+ php_register_variable(variable, value, track_vars_array ELS_CC PLS_CC);
+ *colon = ':';
}
- *colon = 0;
- php_register_variable(variable, value, track_vars_array ELS_CC PLS_CC);
- *colon = ':';
+ variable = php_strtok_r(NULL, "\r\n", &strtok_buf);
}
- variable = php_strtok_r(NULL, "\r\n", &strtok_buf);
+ efree(isapi_special_server_variables[SPECIAL_VAR_ALL_HTTP]);
}
#ifdef PHP_WIN32
}
}
#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 */
{
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;
}
{
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;
}
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:
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;
}
}
-static sapi_module_struct sapi_module = {
+static sapi_module_struct nsapi_sapi_module = {
"nsapi", /* name */
"NSAPI", /* pretty name */
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();
}
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;
return 0;
}
-static sapi_module_struct sapi_module = {
+static sapi_module_struct phttpd_sapi_module = {
"phttpd",
"PHTTPD",
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);
}
-static sapi_module_struct sapi_module = {
+static sapi_module_struct pi3web_sapi_module = {
"pi3web", /* name */
"PI3WEB", /* pretty name */
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();
/* 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 */
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();
}
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();
#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);
* sapi maintenance
*/
-static sapi_module_struct sapi_module = {
+static sapi_module_struct servlet_sapi_module = {
"java_servlet", /* name */
"Java Servlet", /* pretty name */
}
#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;
}
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",
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();
}
}