Return-Path: Delivered-To: apmail-httpd-bugs-archive@www.apache.org Received: (qmail 98388 invoked from network); 11 May 2004 16:50:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 11 May 2004 16:50:50 -0000 Received: (qmail 17997 invoked by uid 500); 11 May 2004 16:52:12 -0000 Delivered-To: apmail-httpd-bugs-archive@httpd.apache.org Received: (qmail 17752 invoked by uid 500); 11 May 2004 16:52:10 -0000 Mailing-List: contact bugs-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: "Apache HTTPD Bugs Notification List" Delivered-To: mailing list bugs@httpd.apache.org Received: (qmail 17734 invoked by uid 98); 11 May 2004 16:52:10 -0000 Received: from anonymous@nagoya.betaversion.org by hermes.apache.org by uid 82 with qmail-scanner-1.20 (clamuko: 0.70. Clear:RC:0(192.18.33.10):. Processed in 0.065232 secs); 11 May 2004 16:52:10 -0000 X-Qmail-Scanner-Mail-From: anonymous@nagoya.betaversion.org via hermes.apache.org X-Qmail-Scanner: 1.20 (Clear:RC:0(192.18.33.10):. Processed in 0.065232 secs) Received: from unknown (HELO exchange.sun.com) (192.18.33.10) by hermes.apache.org with SMTP; 11 May 2004 16:52:10 -0000 Received: (qmail 17129 invoked by uid 50); 11 May 2004 16:51:40 -0000 Date: 11 May 2004 16:51:40 -0000 Message-ID: <20040511165140.17128.qmail@nagoya.betaversion.org> From: bugzilla@apache.org To: bugs@httpd.apache.org Cc: Subject: DO NOT REPLY [Bug 28903] New: - Hooks to add environment variables to CGI and other scripted content handlers X-Spam-Rating: hermes.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://issues.apache.org/bugzilla/show_bug.cgi?id=28903 Hooks to add environment variables to CGI and other scripted content handlers Summary: Hooks to add environment variables to CGI and other scripted content handlers Product: Apache httpd-2.0 Version: 2.0-HEAD Platform: All OS/Version: All Status: NEW Severity: Enhancement Priority: Other Component: Core AssignedTo: bugs@httpd.apache.org ReportedBy: jschneid@netilla.com There is currently no way to override the environment variables set by ap_set_common_vars or ap_set_cgi_vars. The following patch introduces a pair of hook functions (add_vars and add_cgi_vars) that can be used to add new enviroment variables, or override or remove existing environment variables. The hook functions take an apr_table_t * as their only parameter, which is the pointer to the subprocess_env member of the request record. ---- Index: include/http_request.h =================================================================== diff -U3 -r1.1.1.2 http_request.h --- include/http_request.h 2003/04/10 19:09:56 1.1.1.2 +++ include/http_request.h 2004/05/11 16:28:04 @@ -404,6 +404,18 @@ */ AP_DECLARE_HOOK(void,insert_filter,(request_rec *r)) +/** + * This hook allows modules to add environment variables during + * ap_add_common_vars() + */ +AP_DECLARE_HOOK(void,add_vars,(apr_table_t *t)) + +/** + * This hook allows modules to add environment variables during + * ap_add_cgi_vars() + */ +AP_DECLARE_HOOK(void,add_cgi_vars,(apr_table_t *t)) + AP_DECLARE(int) ap_location_walk(request_rec *r); AP_DECLARE(int) ap_directory_walk(request_rec *r); AP_DECLARE(int) ap_file_walk(request_rec *r); Index: server/util_script.c =================================================================== diff -U3 -r1.1.1.2 util_script.c --- server/util_script.c 2003/04/10 19:09:56 1.1.1.2 +++ server/util_script.c 2004/05/11 16:28:04 @@ -85,6 +85,16 @@ #include #endif +/* Hook structure for add_vars and add_cgi_vars */ +APR_HOOK_STRUCT( + APR_HOOK_LINK(add_vars) + APR_HOOK_LINK(add_cgi_vars) +) + +/* implement ap_run_add_vars and ap_run_add_cgi_vars */ +AP_IMPLEMENT_HOOK_VOID(add_vars, (apr_table_t *t), (t)) +AP_IMPLEMENT_HOOK_VOID(add_cgi_vars, (apr_table_t *t), (t)) + /* * Various utility functions which are common to a whole lot of * script-type extensions mechanisms, and might as well be gathered @@ -305,6 +315,7 @@ } } + ap_run_add_vars(e); if (e != r->subprocess_env) { apr_table_overlap(r->subprocess_env, e, APR_OVERLAP_TABLES_SET); } @@ -416,6 +427,7 @@ } ap_destroy_sub_req(pa_req); } + ap_run_add_cgi_vars(e); } --------------------------------------------------------------------- To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org For additional commands, e-mail: bugs-help@httpd.apache.org