aboutsummaryrefslogtreecommitdiff
path: root/fcgiwrap.c
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2010-06-03 14:36:36 +0200
committerFurkan Sahin <furkan-dev@proton.me>2010-06-03 14:36:36 +0200
commitd25d9dba61053cd79f9f17a320530a7739e6153d (patch)
treee6bd7b2d8a0cd3f8dffe1a042ed0e72392d36ad6 /fcgiwrap.c
parentce26ba10cb30e62397ef137464f16683e487ef11 (diff)
Use SCRIPT_FILENAME environment variable when available
If present, it overrides DOCUMENT_ROOT and SCRIPT_NAME and prevents mangling of PATH_INFO. Should allow cleaner configs when script names don't come from request URIs directly.
Diffstat (limited to 'fcgiwrap.c')
-rw-r--r--fcgiwrap.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fcgiwrap.c b/fcgiwrap.c
index 2df84bb..d62e37f 100644
--- a/fcgiwrap.c
+++ b/fcgiwrap.c
@@ -368,6 +368,10 @@ char *get_cgi_filename() /* and fixup environment */
int rf_len;
char *pathinfo = NULL;
+ if ((p = getenv("SCRIPT_FILENAME"))) {
+ return strdup(p);
+ }
+
if ((p = getenv("DOCUMENT_ROOT"))) {
docroot = p;
docrootlen = strlen(p);
@@ -495,7 +499,7 @@ static void handle_fcgi_request()
filename = get_cgi_filename();
inherit_environment();
if (!filename)
- error_403("Cannot get script name, are DOCUMENT_ROOT and SCRIPT_NAME set and is the script executable?", NULL);
+ error_403("Cannot get script name, are DOCUMENT_ROOT and SCRIPT_NAME (or SCRIPT_FILENAME) set and is the script executable?", NULL);
last_slash = strrchr(filename, '/');
if (!last_slash)