CVS update: php4

From: Date: Sat, 26 Jun 1999 19:14:26 +0000
Subject: CVS update: php4
Groups: php.version4 
Request: Send a blank email to php-version4+get-1686@lists.php.net to get a copy of this message
Date: Saturday June 26, 1999 @ 15:14 Author: zeev Update of /repository/php4 In directory php:/tmp/cvs-serv31719 Modified Files: cgi_main.c fopen-wrappers.c request_info.c request_info.h safe_mode.c Log Message: * Get rid of another request_info element (filename) * CGI through Apache should work now Index: php4/cgi_main.c diff -u php4/cgi_main.c:1.19 php4/cgi_main.c:1.20 --- php4/cgi_main.c:1.19 Sat Jun 19 09:18:46 1999 +++ php4/cgi_main.c Sat Jun 26 15:14:26 1999 @@ -178,8 +178,7 @@ zend_file_handle file_handle; char *s; /* temporary locals */ - char *_cgi_filename=NULL; - int _cgi_started=0; + int cgi_started=0; int behavior=PHP_MODE_STANDARD; int no_headers=0; #if SUPPORT_INTERACTIVE @@ -206,6 +205,8 @@ sapi_startup(&sapi_module); + SG(request_info).path_translated = NULL; + #if WIN32|WINNT _fmode = _O_BINARY; /*sets default for file streams to binary */ setmode(_fileno(stdin), O_BINARY); /* make the stdio mode be binary */ @@ -270,7 +271,7 @@ while ((c = getopt(argc, argv, "c:qvisnaeh?vf:")) != -1) { switch (c) { case 'f': - if (!_cgi_started){ + if (!cgi_started){ if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) { php_module_shutdown(); return FAILURE; @@ -279,14 +280,14 @@ if (no_headers) { SG(headers_sent) = 1; } - _cgi_started=1; - _cgi_filename = estrdup(optarg); + cgi_started=1; + SG(request_info).path_translated = estrdup(optarg); /* break missing intentionally */ case 'q': no_headers = 1; break; case 'v': - if (!_cgi_started) { + if (!cgi_started) { if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) { php_module_shutdown(); return FAILURE; @@ -299,7 +300,7 @@ exit(1); break; case 'i': - if (!_cgi_started) { + if (!cgi_started) { if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) { php_module_shutdown(); return FAILURE; @@ -308,7 +309,7 @@ if (no_headers) { SG(headers_sent) = 1; } - _cgi_started=1; + cgi_started=1; php3_TreatHeaders(); _php3_info(); exit(1); @@ -350,7 +351,7 @@ EG(interactive) = interactive; #endif - if (!_cgi_started) { + if (!cgi_started) { if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) { php_module_shutdown(); return FAILURE; @@ -362,9 +363,6 @@ file_handle.filename = "-"; file_handle.type = ZEND_HANDLE_FP; file_handle.handle.fp = stdin; - if (_cgi_filename) { - request_info.filename = _cgi_filename; - } php3_TreatHeaders(); @@ -383,19 +381,18 @@ } SG(request_info).query_string = s; } - if (!request_info.filename && argc > optind) - request_info.filename = argv[optind]; + if (!SG(request_info).path_translated && argc > optind) + SG(request_info).path_translated = argv[optind]; } /* If for some reason the CGI interface is not setting the - PATH_TRANSLATED correctly, request_info.filename is NULL. + PATH_TRANSLATED correctly, SG(request_info).path_translated is NULL. We still call php3_fopen_for_parser, because if you set doc_root or user_dir configuration directives, PATH_INFO is used to construct the filename as a side effect of php3_fopen_for_parser. */ - if (cgi || request_info.filename) { - file_handle.filename = request_info.filename; + if (cgi || SG(request_info).path_translated) { file_handle.handle.fp = php3_fopen_for_parser(); - SG(request_info).path_translated = file_handle.filename; + file_handle.filename = SG(request_info).path_translated; } if (cgi && !file_handle.handle.fp) { Index: php4/fopen-wrappers.c diff -u php4/fopen-wrappers.c:1.22 php4/fopen-wrappers.c:1.23 --- php4/fopen-wrappers.c:1.22 Tue Jun 22 07:04:35 1999 +++ php4/fopen-wrappers.c Sat Jun 26 15:14:26 1999 @@ -27,7 +27,7 @@ | Jim Winstead <jimw@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: fopen-wrappers.c,v 1.22 1999/06/22 11:04:35 ssb Exp $ */ +/* $Id: fopen-wrappers.c,v 1.23 1999/06/26 19:14:26 zeev Exp $ */ /* Synced with php3 revision 1.66 1999-06-18 [ssb] */ @@ -228,7 +228,7 @@ PLS_FETCH(); SLS_FETCH(); - fn = request_info.filename; + fn = SG(request_info).path_translated; path_info = SG(request_info).request_uri; #if HAVE_PWD_H if (PG(user_dir) && *PG(user_dir) @@ -256,8 +256,8 @@ strcat(fn, PG(user_dir)); /* safe */ strcat(fn, "/"); /* safe */ strcat(fn, s + 1); /* safe (shorter than path_info) */ - STR_FREE(request_info.filename); - request_info.filename = fn; + STR_FREE(SG(request_info).path_translated); + SG(request_info).path_translated = fn; } } } @@ -279,17 +279,17 @@ if ('/' == path_info[0]) l--; strcpy(fn + l, path_info); - STR_FREE(request_info.filename); - request_info.filename = fn; + STR_FREE(SG(request_info).path_translated); + SG(request_info).path_translated = fn; } } /* if doc_root && path_info */ if (!fn) { - /* we have to free request_info.filename here because + /* we have to free SG(request_info).path_translated here because php3_destroy_request_info assumes that it will get freed when the include_names hash is emptied, but we're not adding it in this case */ - STR_FREE(request_info.filename); - request_info.filename = NULL; + STR_FREE(SG(request_info).path_translated); + SG(request_info).path_translated = NULL; return NULL; } fp = fopen(fn, "r"); @@ -301,7 +301,7 @@ } if (!fp) { php3_error(E_CORE_ERROR, "Unable to open %s", fn); - STR_FREE(request_info.filename); /* for same reason as above */ + STR_FREE(SG(request_info).path_translated); /* for same reason as above */ return NULL; } @@ -311,6 +311,7 @@ chdir(temp); } efree(temp); + SG(request_info).path_translated = fn; return fp; } Index: php4/request_info.c diff -u php4/request_info.c:1.13 php4/request_info.c:1.14 --- php4/request_info.c:1.13 Mon May 10 20:01:41 1999 +++ php4/request_info.c Sat Jun 26 15:14:26 1999 @@ -71,12 +71,6 @@ } else { request_info.filename = NULL; } -#else - if (SG(request_info).path_translated) { - request_info.filename = estrdup(SG(request_info).path_translated); - } else { - request_info.filename = NULL; - } #endif return SUCCESS; } Index: php4/request_info.h diff -u php4/request_info.h:1.5 php4/request_info.h:1.6 --- php4/request_info.h:1.5 Sun May 9 04:47:48 1999 +++ php4/request_info.h Sat Jun 26 15:14:26 1999 @@ -31,7 +31,6 @@ #define _REQUEST_INFO_H_ typedef struct { - char *filename; char *script_name; char *current_user; int current_user_length; Index: php4/safe_mode.c diff -u php4/safe_mode.c:1.5 php4/safe_mode.c:1.6 --- php4/safe_mode.c:1.5 Mon Apr 26 13:26:32 1999 +++ php4/safe_mode.c Sat Jun 26 15:14:26 1999 @@ -26,7 +26,7 @@ | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ -/* $Id: safe_mode.c,v 1.5 1999/04/26 17:26:32 zeev Exp $ */ +/* $Id: safe_mode.c,v 1.6 1999/06/26 19:14:26 zeev Exp $ */ #include "php.h" @@ -136,7 +136,7 @@ USE_SAPI is defined, because cgi will also be interfaced in USE_SAPI */ #if CGI_BINARY || USE_SAPI || FHTTPD - if (!request_info.filename || (stat(request_info.filename,&statbuf)==-1)) { + if (!SG(request_info).path_translated || (stat(SG(request_info).path_translated,&statbuf)==-1)) { return empty_string; } uid = statbuf.st_uid;

« previous php.version4 (#1686) next »