Skip to content

Use CONTEXT_DOCUMENT_ROOT for scanning dir tree #5051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions sapi/cgi/cgi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,9 +913,12 @@ static int sapi_cgi_activate(void)
if (fcgi_is_fastcgi()) {
fcgi_request *request = (fcgi_request*) SG(server_context);

doc_root = FCGI_GETENV(request, "DOCUMENT_ROOT");
/* Prefer CONTEXT_DOCUMENT_ROOT if set */
doc_root = FCGI_GETENV(request, "CONTEXT_DOCUMENT_ROOT");
doc_root = doc_root ? doc_root : FCGI_GETENV(request, "DOCUMENT_ROOT");
} else {
doc_root = getenv("DOCUMENT_ROOT");
doc_root = getenv("CONTEXT_DOCUMENT_ROOT");
doc_root = doc_root ? doc_root : getenv("DOCUMENT_ROOT");
}
/* DOCUMENT_ROOT should also be defined at this stage..but better check it anyway */
if (doc_root) {
Expand Down
5 changes: 4 additions & 1 deletion sapi/fpm/fpm/fpm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,10 @@ static int sapi_cgi_activate(void) /* {{{ */

/* Load and activate user ini files in path starting from DOCUMENT_ROOT */
if (PG(user_ini_filename) && *PG(user_ini_filename)) {
doc_root = FCGI_GETENV(request, "DOCUMENT_ROOT");
/* Prefer CONTEXT_DOCUMENT_ROOT if set */
doc_root = FCGI_GETENV(request, "CONTEXT_DOCUMENT_ROOT");
doc_root = doc_root ? doc_root : FCGI_GETENV(request, "DOCUMENT_ROOT");

/* DOCUMENT_ROOT should also be defined at this stage..but better check it anyway */
if (doc_root) {
doc_root_len = strlen(doc_root);
Expand Down