You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2002/07/18 14:25:24 UTC

cvs commit: httpd-2.0/docs/manual/mod mod_ext_filter.html.en mod_ext_filter.xml

trawick     2002/07/18 05:25:24

  Modified:    .        CHANGES
               modules/experimental mod_ext_filter.c
               docs/manual/mod mod_ext_filter.html.en mod_ext_filter.xml
  Log:
  mod_ext_filter: Set up environment variables for external programs.
  
  Submitted by:              Craig Sebenik <cr...@netapp.com>
  Reviewed by:               Jeff Trawick
  
  Revision  Changes    Path
  1.870     +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.869
  retrieving revision 1.870
  diff -u -r1.869 -r1.870
  --- CHANGES	17 Jul 2002 19:18:39 -0000	1.869
  +++ CHANGES	18 Jul 2002 12:25:23 -0000	1.870
  @@ -1,5 +1,8 @@
   Changes with Apache 2.0.40
   
  +  *) mod_ext_filter: Set up environment variables for external programs.
  +     [Craig Sebenik <cr...@netapp.com>]
  +
     *) Modified the HTTP_IN filter to immediately append the EOS (end of
        stream) bucket for C-L POST bodies, saving a roundtrip and allowing
        the caller to determine that no content remains without prefetching
  
  
  
  1.34      +21 -2     httpd-2.0/modules/experimental/mod_ext_filter.c
  
  Index: mod_ext_filter.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_ext_filter.c,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- mod_ext_filter.c	11 Jul 2002 05:42:18 -0000	1.33
  +++ mod_ext_filter.c	18 Jul 2002 12:25:24 -0000	1.34
  @@ -68,6 +68,7 @@
   #include "http_core.h"
   #include "apr_buckets.h"
   #include "util_filter.h"
  +#include "util_script.h"
   #include "apr_strings.h"
   #include "apr_hash.h"
   #include "apr_lib.h"
  @@ -395,6 +396,7 @@
       ef_ctx_t *ctx = f->ctx;
       apr_status_t rc;
       ef_dir_t *dc = ctx->dc;
  +    const char * const *env;
   
       ctx->proc = apr_pcalloc(ctx->p, sizeof(*ctx->proc));
   
  @@ -416,11 +418,28 @@
                                         NULL);
           ap_assert(rc == APR_SUCCESS);
       }
  -                                  
  +
  +    /* add standard CGI variables as well as DOCUMENT_URI, DOCUMENT_PATH_INFO,
  +     * and QUERY_STRING_UNESCAPED
  +     */
  +    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) {
  
  
  
  1.4       +4 -1      httpd-2.0/docs/manual/mod/mod_ext_filter.html.en
  
  Index: mod_ext_filter.html.en
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/docs/manual/mod/mod_ext_filter.html.en,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- mod_ext_filter.html.en	26 Jun 2002 19:54:53 -0000	1.3
  +++ mod_ext_filter.html.en	18 Jul 2002 12:25:24 -0000	1.4
  @@ -148,7 +148,10 @@
         program name, the command line should be surrounded in
         quotation marks (e.g., <em>cmd="/bin/mypgm arg1 arg2"</em>.
         Normal shell quoting is not necessary since the program is
  -      run directly, bypassing the shell.</dd>
  +      run directly, bypassing the shell.  In addition to the 
  +      standard CGI environment variables, DOCUMENT_URI,
  +      DOCUMENT_PATH_INFO, and QUERY_STRING_UNESCAPED will also be set
  +      for the program.</dd>
   
         <dt>mode=<em>mode</em></dt>
   
  
  
  
  1.4       +4 -1      httpd-2.0/docs/manual/mod/mod_ext_filter.xml
  
  Index: mod_ext_filter.xml
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/docs/manual/mod/mod_ext_filter.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- mod_ext_filter.xml	26 Jun 2002 19:54:53 -0000	1.3
  +++ mod_ext_filter.xml	18 Jul 2002 12:25:24 -0000	1.4
  @@ -164,7 +164,10 @@
         program name, the command line should be surrounded in
         quotation marks (e.g., <em>cmd="/bin/mypgm arg1 arg2"</em>.
         Normal shell quoting is not necessary since the program is
  -      run directly, bypassing the shell.</dd>
  +      run directly, bypassing the shell.  In addition to the 
  +      standard CGI environment variables, DOCUMENT_URI,
  +      DOCUMENT_PATH_INFO, and QUERY_STRING_UNESCAPED will also be set
  +      for the program.</dd>
   
         <dt>mode=<em>mode</em></dt>