httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 28903] New: - Hooks to add environment variables to CGI and other scripted content handlers
Date Tue, 11 May 2004 16:51:40 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28903>.
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.

--<cut here>--
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 <os2.h>
 #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


Mime
View raw message