httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@locus.apache.org
Subject cvs commit: apache-2.0/src/modules/experimental mod_charset_lite.c
Date Wed, 25 Oct 2000 16:49:25 GMT
trawick     00/10/25 09:49:22

  Modified:    src/modules/experimental mod_charset_lite.c
  Log:
  Don't segfault if the filter doesn't have any request config prepared.
  This can happen when the config doesn't tell us to do anything but the
  administrator coded us in Add{Input|Output}Filter.  Instead of segfaulting,
  we turn into a noop.
  
  Revision  Changes    Path
  1.29      +22 -14    apache-2.0/src/modules/experimental/mod_charset_lite.c
  
  Index: mod_charset_lite.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/experimental/mod_charset_lite.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- mod_charset_lite.c	2000/10/24 15:49:04	1.28
  +++ mod_charset_lite.c	2000/10/25 16:49:14	1.29
  @@ -801,7 +801,8 @@
   {
       charset_req_t *reqinfo = ap_get_module_config(f->r->request_config,
                                                     &charset_lite_module);
  -    charset_dir_t *dc = reqinfo->dc;
  +    charset_dir_t *dc = ap_get_module_config(f->r->per_dir_config,
  +                                             &charset_lite_module);
       charset_filter_ctx_t *ctx = f->ctx;
       ap_bucket *dptr, *consumed_bucket;
       const char *cur_str;
  @@ -813,13 +814,16 @@
   
       if (!ctx) { 
           /* this is AddOutputFilter path; grab the preallocated context,
  -         * if any 
  +         * if any; note that if we decided not to do anything in an earlier
  +         * handler, we won't even have a reqinfo
            */
  -        ctx = f->ctx = reqinfo->output_ctx;
  -        reqinfo->output_ctx = NULL;   /* prevent SNAFU if user coded us twice
  -                                       * in the filter chain; we can't have two
  -                                       * instances using the same context
  -                                       */
  +        if (reqinfo) {
  +            ctx = f->ctx = reqinfo->output_ctx;
  +            reqinfo->output_ctx = NULL; /* prevent SNAFU if user coded us twice
  +                                         * in the filter chain; we can't have two
  +                                         * instances using the same context
  +                                         */
  +        }
           if (!ctx) {                   /* no idea how to translate; don't do anything */
               ctx = f->ctx = apr_pcalloc(f->r->pool, sizeof(charset_filter_ctx_t));
               ctx->dc = dc;
  @@ -971,20 +975,24 @@
       apr_status_t rv;
       charset_req_t *reqinfo = ap_get_module_config(f->r->request_config,
                                                     &charset_lite_module);
  -    charset_dir_t *dc = reqinfo->dc;
  +    charset_dir_t *dc = ap_get_module_config(f->r->per_dir_config,
  +                                             &charset_lite_module);
       charset_filter_ctx_t *ctx = f->ctx;
       apr_size_t buffer_size;
       int hit_eos;
   
       if (!ctx) { 
           /* this is AddInputFilter path; grab the preallocated context,
  -         * if any
  +         * if any; note that if we decided not to do anything in an earlier
  +         * handler, we won't even have a reqinfo
            */
  -        ctx = f->ctx = reqinfo->input_ctx;
  -        reqinfo->input_ctx = NULL;    /* prevent SNAFU if user coded us twice
  -                                       * in the filter chain; we can't have two
  -                                       * instances using the same context
  -                                       */
  +        if (reqinfo) {
  +            ctx = f->ctx = reqinfo->input_ctx;
  +            reqinfo->input_ctx = NULL; /* prevent SNAFU if user coded us twice
  +                                        * in the filter chain; we can't have two
  +                                        * instances using the same context
  +                                        */
  +        }
           if (!ctx) {                   /* no idea how to translate; don't do anything */
               ctx = f->ctx = apr_pcalloc(f->r->pool, sizeof(charset_filter_ctx_t));
               ctx->dc = dc;
  
  
  

Mime
View raw message