DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10925>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10925

[PATCH] environment in mod_ext_filter

           Summary: [PATCH] environment in mod_ext_filter
           Product: Apache httpd-2.0
           Version: 2.0.39
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: mod_ext_filter
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: [EMAIL PROTECTED]


> diff -u orig-mod_ext_filter.c mod_ext_filter.c 
--- orig-mod_ext_filter.c       Wed Jul 17 12:07:58 2002
+++ mod_ext_filter.c    Wed Jul 17 13:55:11 2002
@@ -382,7 +382,9 @@
     ef_ctx_t *ctx = f->ctx;
     apr_status_t rc;
     ef_dir_t *dc = ctx->dc;
-
+    const char * const *env;
+    apr_table_t *e = f->r->subprocess_env;
+        
     ctx->proc = apr_pcalloc(ctx->p, sizeof(*ctx->proc));
 
     rc = apr_procattr_create(&ctx->procattr, ctx->p);
@@ -404,10 +406,29 @@
         ap_assert(rc == APR_SUCCESS);
     }
                                   
+    /* adding the CGI vars seems like a bit of overkill, but I figure the only
+     * drawback is the time necessary to run the routine.
+     * If someone is using mod_ext_filter, then they are probably not
+     * overly concerned about performance.
+     */
+    ap_add_cgi_vars(f->r);
+    apr_table_setn(f->r->subprocess_env, "DOCUMENT_URI", f->r->uri);
+    apr_table_setn(f->r->subprocess_env, "DOCUMENT_PATH_INFO", 
f->r->path_info);
+    if (f->r->args) {
+            /* QUERY_STRING is added by ap_add_cgi_vars */
+        char *arg_copy = apr_pstrdup(f->r->pool, f->r->args);
+        ap_unescape_url(arg_copy);
+        apr_table_setn(f->r->subprocess_env, "QUERY_STRING_UNESCAPED",
+                       ap_escape_shell_cmd(f->r->pool, arg_copy));
+    }
+
+    env = (const char * const *) ap_create_environment(ctx->p,
+                                                       f->r->subprocess_env);
+
     rc = apr_proc_create(ctx->proc, 
                             ctx->filter->command, 
                             (const char * const *)ctx->filter->args, 
-                            NULL, /* environment */
+                            env, /* environment */
                             ctx->procattr, 
                             ctx->p);
     if (rc != APR_SUCCESS) {

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to