[PHP4BETA] CVS update: php4

From: Date: Sun, 02 May 1999 18:07:40 +0000
Subject: [PHP4BETA] CVS update: php4
Groups: php.version4 
Request: Send a blank email to php-version4+get-618@lists.php.net to get a copy of this message
Date: Sunday May 2, 1999 @ 14:07 Author: andi Update of /repository/php4 In directory php:/tmp/cvs-serv13198 Modified Files: SAPI.c SAPI.h cgi_main.c main.c main.h mod_php3.c output.c request_info.c request_info.h Log Message: - Make ISAPI hook in as an extension too. - Some work on moving stuff to SAPI. Index: php4/SAPI.c diff -u php4/SAPI.c:1.3 php4/SAPI.c:1.4 --- php4/SAPI.c:1.3 Mon Apr 26 13:26:32 1999 +++ php4/SAPI.c Sun May 2 14:07:40 1999 @@ -11,11 +11,11 @@ #endif /* A true global (no need for thread safety) */ -sapi_functions_struct sapi_functions; +sapi_module_struct sapi_module; -void sapi_startup(sapi_functions_struct *sf) +SAPI_API void sapi_startup(sapi_module_struct *sf) { - sapi_functions = *sf; + sapi_module = *sf; #ifdef ZTS sapi_globals_id = ts_allocate_id(sizeof(sapi_globals_struct), NULL, NULL); #endif Index: php4/SAPI.h diff -u php4/SAPI.h:1.2 php4/SAPI.h:1.3 --- php4/SAPI.h:1.2 Mon Apr 26 10:00:46 1999 +++ php4/SAPI.h Sun May 2 14:07:40 1999 @@ -13,19 +13,32 @@ #endif -typedef struct { +typedef struct _sapi_module_struct { + char *name; + + int (*startup)(struct _sapi_module_struct *sapi_module); + int (*shutdown)(struct _sapi_module_struct *sapi_module); + int (*ub_write)(const char *str, unsigned int str_length); -} sapi_functions_struct; +} sapi_module_struct; + -extern sapi_functions_struct sapi_functions; /* true global */ +extern sapi_module_struct sapi_module; /* true global */ + + +typedef struct { + char *path_translated; + char *query_string; +} sapi_request_info; typedef struct { void *server_context; + sapi_request_info request_info; } sapi_globals_struct; -void sapi_startup(sapi_functions_struct *sf); +SAPI_API void sapi_startup(sapi_module_struct *sf); #ifdef ZTS # define SLS_D sapi_globals_struct *sapi_globals Index: php4/cgi_main.c diff -u php4/cgi_main.c:1.3 php4/cgi_main.c:1.4 --- php4/cgi_main.c:1.3 Mon Apr 26 15:48:10 1999 +++ php4/cgi_main.c Sun May 2 14:07:40 1999 @@ -76,8 +76,13 @@ } -static sapi_functions_struct sapi_functions = { - zend_cgibin_ub_write +static sapi_module_struct sapi_module = { + "PHP Language", /* name */ + + php_module_startup, /* startup */ + php_module_shutdown_wrapper, /* shutdown */ + + zend_cgibin_ub_write, /* unbuffered write */ }; @@ -127,6 +132,7 @@ zend_compiler_globals *compiler_globals; zend_executor_globals *executor_globals; php_core_globals *core_globals; + sapi_globals_struct *sapi_globals; #endif @@ -135,7 +141,10 @@ return -1; } #endif - + + tsrm_startup(1,1,0); + sapi_startup(&sapi_module); + #if WIN32|WINNT _fmode = _O_BINARY; /*sets default for file streams to binary */ setmode(_fileno(stdin), O_BINARY); /* make the stdio mode be binary */ @@ -178,13 +187,14 @@ #endif /* FORCE_CGI_REDIRECT */ } - if (php_module_startup(&sapi_functions)==FAILURE) { + if (php_module_startup(&sapi_module)==FAILURE) { return FAILURE; } #ifdef ZTS compiler_globals = ts_resource(compiler_globals_id); executor_globals = ts_resource(executor_globals_id); core_globals = ts_resource(core_globals_id); + sapi_globals = ts_resource(sapi_globals_id); #endif CG(extended_info) = 0; @@ -280,8 +290,10 @@ php3_TreatHeaders(); + SG(request_info).query_string = getenv("QUERY_STRING"); + if (!cgi) { - if (!request_info.query_string) { + if (!SG(request_info).query_string) { for (i = optind, len = 0; i < argc; i++) len += strlen(argv[i]) + 1; @@ -292,7 +304,7 @@ if (i < (argc - 1)) strcat(s, "+"); } - request_info.query_string = s; + SG(request_info).query_string = s; } if (!request_info.filename && argc > optind) request_info.filename = argv[optind]; Index: php4/main.c diff -u php4/main.c:1.41 php4/main.c:1.42 --- php4/main.c:1.41 Wed Apr 28 17:29:31 1999 +++ php4/main.c Sun May 2 14:07:40 1999 @@ -29,7 +29,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.41 1999/04/28 21:29:31 zeev Exp $ */ +/* $Id: main.c,v 1.42 1999/05/02 18:07:40 andi Exp $ */ #include <stdio.h> @@ -755,7 +755,7 @@ #endif -int php_module_startup(sapi_functions_struct *sf) +int php_module_startup(sapi_module_struct *sf) { zend_utility_functions zuf; zend_utility_values zuv; @@ -775,7 +775,7 @@ return SUCCESS; } - sapi_functions = *sf; + sapi_module = *sf; zend_output_startup(); @@ -796,7 +796,6 @@ #endif PG(header_is_being_sent) = 0; - sapi_startup(sf); #if HAVE_SETLOCALE setlocale(LC_CTYPE, ""); @@ -840,6 +839,14 @@ /* used to close fd's in the range 3.255 here, but it's problematic */ } + +int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals) +{ + php_module_shutdown(); + return SUCCESS; +} + + void php_module_shutdown() { int module_number=0; /* for UNREGISTER_INI_ENTRIES() */ @@ -875,12 +882,12 @@ /* in 3.1 some of this should move into sapi */ -int _php3_hash_environment(PLS_D) +int _php3_hash_environment(PLS_D ELS_DC) { char **env, *p, *t; unsigned char _gpc_flags[3] = {0,0,0}; pval *tmp; - ELS_FETCH(); + SLS_FETCH(); p = PG(gpc_order); while(*p) { @@ -1050,7 +1057,7 @@ /* need argc/argv support as well */ - _php3_build_argv(request_info.query_string ELS_CC); + _php3_build_argv(SG(request_info).query_string ELS_CC); return SUCCESS; } @@ -1113,16 +1120,17 @@ { zend_file_handle *prepend_file_p, *append_file_p; zend_file_handle prepend_file, append_file; + SLS_FETCH(); - if (request_info.query_string && request_info.query_string[0]=='=') { - if (!strcmp(request_info.query_string+1, "PHPE9568F34-D428-11d2-A769-00AA001ACF42")) { + if (SG(request_info).query_string && SG(request_info).query_string[0]=='=') { + if (!strcmp(SG(request_info).query_string+1, "PHPE9568F34-D428-11d2-A769-00AA001ACF42")) { char *header_line = estrndup("Content-type: image/gif", sizeof("Content-type: image/gif")-1); php4i_add_header_information(header_line); PHPWRITE(php4_logo, sizeof(php4_logo)); efree(header_line); return; - } else if (!strcmp(request_info.query_string+1, "PHPE9568F35-D428-11d2-A769-00AA001ACF42")) { + } else if (!strcmp(SG(request_info).query_string+1, "PHPE9568F35-D428-11d2-A769-00AA001ACF42")) { char *header_line = estrndup("Content-type: image/gif", sizeof("Content-type: image/gif")-1); php4i_add_header_information(header_line); @@ -1136,7 +1144,7 @@ PG(unclean_shutdown) = 1; return; } - _php3_hash_environment(PLS_C); + _php3_hash_environment(PLS_C ELS_CC); #if WIN32||WINNT UpdateIniFromRegistry(primary_file->filename); Index: php4/main.h diff -u php4/main.h:1.6 php4/main.h:1.7 --- php4/main.h:1.6 Mon Apr 26 10:00:46 1999 +++ php4/main.h Sun May 2 14:07:40 1999 @@ -29,7 +29,7 @@ */ -/* $Id: main.h,v 1.6 1999/04/26 14:00:46 zeev Exp $ */ +/* $Id: main.h,v 1.7 1999/05/02 18:07:40 andi Exp $ */ #ifndef _MAIN_H @@ -42,9 +42,10 @@ PHPAPI int php_request_startup(CLS_D ELS_DC PLS_DC); PHPAPI void php_request_shutdown(void *dummy); PHPAPI void php_request_shutdown_for_exec(void *dummy); -PHPAPI int php_module_startup(sapi_functions_struct *sf); +PHPAPI int php_module_startup(sapi_module_struct *sf); PHPAPI void php_module_shutdown(); PHPAPI void php_module_shutdown_for_exec(void); +PHPAPI int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals); PHPAPI void php_execute_script(zend_file_handle *primary_file CLS_DC ELS_DC PLS_DC); Index: php4/mod_php3.c diff -u php4/mod_php3.c:1.12 php4/mod_php3.c:1.13 --- php4/mod_php3.c:1.12 Mon Apr 26 13:26:32 1999 +++ php4/mod_php3.c Sun May 2 14:07:40 1999 @@ -28,7 +28,7 @@ | PHP4 patches by Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: mod_php3.c,v 1.12 1999/04/26 17:26:32 zeev Exp $ */ +/* $Id: mod_php3.c,v 1.13 1999/05/02 18:07:40 andi Exp $ */ #include "httpd.h" #include "http_config.h" @@ -88,7 +88,7 @@ php_apache_info_struct php_apache_info; /* active config */ int apache_php3_module_main(request_rec * r, int fd, int display_source_mode); -int php_module_startup(sapi_functions_struct *sf); +int php_module_startup(sapi_module_struct *sf); void php_module_shutdown(); void php_module_shutdown_for_exec(); @@ -112,7 +112,7 @@ } -sapi_functions_struct sapi_functions = { +sapi_module_struct sapi_module = { zend_apache_ub_write }; @@ -268,7 +268,7 @@ void php3_init_handler(server_rec *s, pool *p) { register_cleanup(p, NULL, php_module_shutdown, php_module_shutdown_for_exec); - php_module_startup(&sapi_functions); + php_module_startup(&sapi_module); #if MODULE_MAGIC_NUMBER >= 19980527 ap_add_version_component("PHP/" PHP_VERSION); #endif Index: php4/output.c diff -u php4/output.c:1.5 php4/output.c:1.6 --- php4/output.c:1.5 Mon Apr 26 10:00:46 1999 +++ php4/output.c Sun May 2 14:07:40 1999 @@ -48,7 +48,7 @@ ob_buffer = NULL; zend_body_write = zend_ub_body_write; header_request=0; - zend_header_write = sapi_functions.ub_write; + zend_header_write = sapi_module.ub_write; } Index: php4/request_info.c diff -u php4/request_info.c:1.6 php4/request_info.c:1.7 --- php4/request_info.c:1.6 Mon Apr 26 13:26:32 1999 +++ php4/request_info.c Sun May 2 14:07:40 1999 @@ -38,10 +38,10 @@ int php3_init_request_info(void *conf) { char *buf; /* temporary buffers */ + SLS_FETCH(); request_info.path_info = getenv("PATH_INFO"); request_info.path_translated = getenv("PATH_TRANSLATED"); - request_info.query_string = getenv("QUERY_STRING"); request_info.current_user = NULL; request_info.current_user_length = 0; request_info.request_method = getenv("REQUEST_METHOD"); @@ -199,12 +199,12 @@ SLS_FETCH(); r = ((request_rec *) SG(server_context)); + SG(request_info).query_string = r->args; request_info.current_user = NULL; request_info.current_user_length = 0; request_info.filename = r->filename; request_info.request_method = r->method; - request_info.query_string = r->args; request_info.content_type = table_get(r->subprocess_env, "CONTENT_TYPE"); buf = table_get(r->subprocess_env, "CONTENT_LENGTH"); @@ -227,7 +227,6 @@ request_info.filename = NULL; request_info.path_info = sapi_rqst->path_info; request_info.path_translated = sapi_rqst->path_translated; - request_info.query_string = sapi_rqst->query_string; request_info.current_user = sapi_rqst->current_user; request_info.current_user_length = sapi_rqst->current_user_length; request_info.request_method = sapi_rqst->request_method; Index: php4/request_info.h diff -u php4/request_info.h:1.2 php4/request_info.h:1.3 --- php4/request_info.h:1.2 Mon Apr 26 10:00:46 1999 +++ php4/request_info.h Sun May 2 14:07:40 1999 @@ -34,7 +34,6 @@ char *filename; char *path_info; const char *path_translated; - char *query_string; const char *request_method; char *script_name; char *current_user; -- PHP 4 Beta

« previous php.version4 (#618) next »