1999-04-08 05:05:13 +08:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
1999-07-16 21:13:16 +08:00
|
|
|
| PHP version 4.0 |
|
1999-04-08 05:05:13 +08:00
|
|
|
+----------------------------------------------------------------------+
|
1999-07-16 21:13:16 +08:00
|
|
|
| Copyright (c) 1997, 1998, 1999 The PHP Group |
|
1999-04-08 05:05:13 +08:00
|
|
|
+----------------------------------------------------------------------+
|
1999-07-16 21:13:16 +08:00
|
|
|
| This source file is subject to version 2.0 of the PHP license, |
|
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
|
|
|
| available at through the world-wide-web at |
|
|
|
|
| http://www.php.net/license/2_0.txt. |
|
|
|
|
| If you did not receive a copy of the PHP license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@php.net so we can mail you a copy immediately. |
|
1999-04-08 05:05:13 +08:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Author: Jim Winstead (jimw@php.net) |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "php.h"
|
1999-04-27 01:26:37 +08:00
|
|
|
#include "SAPI.h"
|
1999-04-08 05:05:13 +08:00
|
|
|
|
|
|
|
#ifndef THREAD_SAFE
|
1999-04-26 22:00:49 +08:00
|
|
|
PHPAPI php3_request_info request_info;
|
1999-04-08 05:05:13 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if CGI_BINARY
|
|
|
|
int php3_init_request_info(void *conf)
|
|
|
|
{
|
1999-05-03 02:07:41 +08:00
|
|
|
SLS_FETCH();
|
1999-04-24 08:12:00 +08:00
|
|
|
|
|
|
|
request_info.current_user = NULL;
|
|
|
|
request_info.current_user_length = 0;
|
|
|
|
request_info.script_name = getenv("SCRIPT_NAME");
|
|
|
|
request_info.script_filename = getenv("SCRIPT_FILENAME");
|
1999-04-08 05:05:13 +08:00
|
|
|
/* Hack for annoying servers that do not set SCRIPT_FILENAME for us */
|
1999-04-24 08:12:00 +08:00
|
|
|
if (!request_info.script_filename) {
|
|
|
|
request_info.script_filename = request_info.php_argv0;
|
1999-04-08 05:05:13 +08:00
|
|
|
}
|
|
|
|
#if WIN32|WINNT
|
|
|
|
/* FIXME WHEN APACHE NT IS FIXED */
|
|
|
|
/* a hack for apache nt because it does not appear to set argv[1] and sets
|
|
|
|
script filename to php.exe thus makes us parse php.exe instead of file.php
|
|
|
|
requires we get the info from path translated. This can be removed at
|
|
|
|
such a time taht apache nt is fixed */
|
1999-05-03 03:31:56 +08:00
|
|
|
else {
|
|
|
|
request_info.script_filename = getenv("PATH_TRANSLATED");
|
1999-04-08 05:05:13 +08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* doc_root configuration variable is currently ignored,
|
|
|
|
as it is with every other access method currently also. */
|
|
|
|
|
|
|
|
/* We always need to emalloc() filename, since it gets placed into
|
|
|
|
the include file hash table, and gets freed with that table.
|
|
|
|
Notice that this means that we don't need to efree() it in
|
|
|
|
php3_destroy_request_info()! */
|
|
|
|
#if DISCARD_PATH
|
1999-04-24 08:12:00 +08:00
|
|
|
if (request_info.script_filename) {
|
1999-06-27 07:21:18 +08:00
|
|
|
SG(request_info).path_translated = estrdup(request_info.script_filename);
|
1999-04-08 05:05:13 +08:00
|
|
|
} else {
|
1999-06-27 07:21:18 +08:00
|
|
|
SG(request_info).path_translated = NULL;
|
1999-04-08 05:05:13 +08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int php3_destroy_request_info(void *conf)
|
|
|
|
{
|
1999-04-24 08:12:00 +08:00
|
|
|
STR_FREE(request_info.current_user);
|
1999-04-08 05:05:13 +08:00
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if APACHE
|
|
|
|
int php3_init_request_info(void *conf)
|
|
|
|
{
|
1999-04-27 01:26:37 +08:00
|
|
|
request_rec *r;
|
|
|
|
SLS_FETCH();
|
1999-04-08 05:05:13 +08:00
|
|
|
|
1999-04-27 01:26:37 +08:00
|
|
|
r = ((request_rec *) SG(server_context));
|
1999-04-24 08:12:00 +08:00
|
|
|
request_info.current_user = NULL;
|
|
|
|
request_info.current_user_length = 0;
|
1999-04-08 05:05:13 +08:00
|
|
|
|
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !CGI_BINARY
|
|
|
|
int php3_destroy_request_info(void *conf)
|
|
|
|
{
|
|
|
|
/* see above for why we don't want to efree() request_info.filename */
|
1999-10-07 21:23:33 +08:00
|
|
|
STR_FREE(request_info.current_user);
|
1999-04-08 05:05:13 +08:00
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* tab-width: 4
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* End:
|
|
|
|
*/
|