httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: httpd-2.0/modules/experimental mod_ext_filter.c
Date Wed, 26 Jun 2002 13:01:50 GMT
trawick     2002/06/26 06:01:50

  Modified:    .        CHANGES
               modules/experimental mod_ext_filter.c
  Log:
  Fix mod_ext_filter to look in the main server for filter definitions
  when running in a vhost if the filter definition is not found in
  the vhost.
  
  PR:    10147
  
  Revision  Changes    Path
  1.850     +4 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.849
  retrieving revision 1.850
  diff -u -r1.849 -r1.850
  --- CHANGES	24 Jun 2002 04:55:23 -0000	1.849
  +++ CHANGES	26 Jun 2002 13:01:49 -0000	1.850
  @@ -1,5 +1,9 @@
   Changes with Apache 2.0.40
   
  +  *) Fix mod_ext_filter to look in the main server for filter definitions
  +     when running in a vhost if the filter definition is not found in
  +     the vhost.  PR 10147  [Jeff Trawick]
  +
     *) Support WinNT CGI invocation through ScriptInterpreterSource 
        'registry' for script interpreter paths and names with non-ascii
        characters in the executable filepath.  [William Rowe]
  
  
  
  1.30      +29 -4     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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- mod_ext_filter.c	12 Jun 2002 23:59:30 -0000	1.29
  +++ mod_ext_filter.c	26 Jun 2002 13:01:50 -0000	1.30
  @@ -110,6 +110,7 @@
   } ef_ctx_t;
   
   module AP_MODULE_DECLARE_DATA ext_filter_module;
  +static const server_rec *main_server;
   
   static apr_status_t ef_output_filter(ap_filter_t *, apr_bucket_brigade *);
   
  @@ -341,6 +342,17 @@
       {NULL}
   };
   
  +static int ef_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *main_s)
  +{
  +    main_server = main_s;
  +    return OK;
  +}
  +
  +static void register_hooks(apr_pool_t *p)
  +{
  +    ap_hook_post_config(ef_init, NULL, NULL, APR_HOOK_MIDDLE);
  +}
  +
   static apr_status_t set_resource_limits(request_rec *r, 
                                           apr_procattr_t *procattr)
   {
  @@ -469,21 +481,33 @@
                           intype_str, outtype_str);
   }
   
  +static ef_filter_t *find_filter_def(const server_rec *s, const char *fname)
  +{
  +    ef_server_t *sc;
  +    ef_filter_t *f;
  +
  +    sc = ap_get_module_config(s->module_config, &ext_filter_module);
  +    f = apr_hash_get(sc->h, fname, APR_HASH_KEY_STRING);
  +    if (!f && s != main_server) {
  +        s = main_server;
  +        sc = ap_get_module_config(s->module_config, &ext_filter_module);
  +        f = apr_hash_get(sc->h, fname, APR_HASH_KEY_STRING);
  +    }
  +    return f;
  +}
  +
   static apr_status_t init_filter_instance(ap_filter_t *f)
   {
       ef_ctx_t *ctx;
       ef_dir_t *dc;
  -    ef_server_t *sc;
       apr_status_t rv;
   
       f->ctx = ctx = apr_pcalloc(f->r->pool, sizeof(ef_ctx_t));
       dc = ap_get_module_config(f->r->per_dir_config,
                                 &ext_filter_module);
  -    sc = ap_get_module_config(f->r->server->module_config,
  -                              &ext_filter_module);
       ctx->dc = dc;
       /* look for the user-defined filter */
  -    ctx->filter = apr_hash_get(sc->h, f->frec->name, APR_HASH_KEY_STRING);
  +    ctx->filter = find_filter_def(f->r->server, f->frec->name);
       if (!ctx->filter) {
           ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, f->r,
                         "couldn't find definition of filter '%s'",
  @@ -798,4 +822,5 @@
       create_ef_server_conf,
       NULL,
       cmds,
  +    register_hooks
   };
  
  
  

Mime
View raw message