1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
$NetBSD: patch-aa,v 1.10 2004/04/30 00:06:42 lukem Exp $
--- sapi/cgi/cgi_main.c.orig 2004-04-01 03:01:45.000000000 +1000
+++ sapi/cgi/cgi_main.c
@@ -679,6 +679,20 @@ static void init_request_info(TSRMLS_D)
char *env_script_filename = sapi_cgibin_getenv("SCRIPT_FILENAME",0 TSRMLS_CC);
char *env_path_translated = sapi_cgibin_getenv("PATH_TRANSLATED",0 TSRMLS_CC);
char *script_path_translated = env_script_filename;
+ char *env_script_name = sapi_cgibin_getenv("SCRIPT_NAME",0 TSRMLS_CC);
+
+ /*
+ * CGI/1.1, as documented at:
+ * http://cgi-spec.golux.com/
+ * mentions SCRIPT_NAME but not SCRIPT_FILENAME.
+ * Support web servers that only supply the former,
+ * even though PHP 4.3 wants the latter ...
+ */
+ if (!script_path_translated && env_script_name && *env_script_name == '/') {
+ env_script_filename = _sapi_cgibin_putenv("SCRIPT_FILENAME",(env_script_name + 1) TSRMLS_CC);
+
+ script_path_translated = env_script_filename;
+ }
#if !DISCARD_PATH
/* some broken servers do not have script_filename or argv0
@@ -707,7 +721,6 @@ static void init_request_info(TSRMLS_D)
char *content_length = sapi_cgibin_getenv("CONTENT_LENGTH",0 TSRMLS_CC);
char *content_type = sapi_cgibin_getenv("CONTENT_TYPE",0 TSRMLS_CC);
char *env_path_info = sapi_cgibin_getenv("PATH_INFO",0 TSRMLS_CC);
- char *env_script_name = sapi_cgibin_getenv("SCRIPT_NAME",0 TSRMLS_CC);
#if ENABLE_PATHINFO_CHECK
struct stat st;
char *env_redirect_url = sapi_cgibin_getenv("REDIRECT_URL",0 TSRMLS_CC);
|