From: Luca Toscano Date: Sun, 24 Jan 2016 16:39:30 +0000 (+0000) Subject: mod_cgi/mod_cgid documentation about environment variables added (like DOCUMENT_ROOT). X-Git-Tag: 2.5.0-alpha~2286 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4eb7f3d2640acf61386c5abf5478ce8d12ce614a;p=apache mod_cgi/mod_cgid documentation about environment variables added (like DOCUMENT_ROOT). Bug: 58305 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1726506 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_cgi.xml b/docs/manual/mod/mod_cgi.xml index b459c48bb6..e7035c2f25 100644 --- a/docs/manual/mod/mod_cgi.xml +++ b/docs/manual/mod/mod_cgi.xml @@ -100,7 +100,15 @@
This will only be set if the CGI script is subject to authentication.
+ +

This module also leverages the core functions + ap_add_common_vars and + ap_add_cgi_vars + to add common CGI environment variables like DOCUMENT_ROOT + (this one from the related DocumentRoot directive). + For an exhaustive list please check the code in the appropriate httpd branch. +

CGI Debugging diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c index 28d93c535b..000f06e5bd 100644 --- a/modules/generators/mod_cgi.c +++ b/modules/generators/mod_cgi.c @@ -21,10 +21,10 @@ * * Adapted by rst from original NCSA code by Rob McCool * - * Apache adds some new env vars; REDIRECT_URL and REDIRECT_QUERY_STRING for - * custom error responses, and DOCUMENT_ROOT because we found it useful. - * It also adds SERVER_ADMIN - useful for scripts to know who to mail when - * they fail. + * This modules uses a httpd core function (ap_add_common_vars) to add some new env vars, + * like REDIRECT_URL and REDIRECT_QUERY_STRING for custom error responses and DOCUMENT_ROOT. + * It also adds SERVER_ADMIN - useful for scripts to know who to mail when they fail. + * */ #include "apr.h" diff --git a/modules/generators/mod_cgid.c b/modules/generators/mod_cgid.c index a605c0ba4f..edc2524929 100644 --- a/modules/generators/mod_cgid.c +++ b/modules/generators/mod_cgid.c @@ -21,10 +21,10 @@ * * Adapted by rst from original NCSA code by Rob McCool * - * Apache adds some new env vars; REDIRECT_URL and REDIRECT_QUERY_STRING for - * custom error responses, and DOCUMENT_ROOT because we found it useful. - * It also adds SERVER_ADMIN - useful for scripts to know who to mail when - * they fail. + * This modules uses a httpd core function (ap_add_common_vars) to add some new env vars, + * like REDIRECT_URL and REDIRECT_QUERY_STRING for custom error responses and DOCUMENT_ROOT. + * It also adds SERVER_ADMIN - useful for scripts to know who to mail when they fail. + * */ #include "apr_lib.h" @@ -1459,13 +1459,18 @@ static int cgid_handler(request_rec *r) return log_scripterror(r, conf, HTTP_NOT_FOUND, 0, APLOGNO(01266) "AcceptPathInfo off disallows user's path"); } -/* + /* if (!ap_suexec_enabled) { if (!ap_can_exec(&r->finfo)) return log_scripterror(r, conf, HTTP_FORBIDDEN, 0, APLOGNO(01267) "file permissions deny server execution"); } -*/ + */ + + /* + * httpd core function used to add common environment variables like + * DOCUMENT_ROOT. + */ ap_add_common_vars(r); ap_add_cgi_vars(r); env = ap_create_environment(r->pool, r->subprocess_env);