httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: httpd-2.0/server core.c
Date Thu, 30 Aug 2001 05:10:54 GMT
wrowe       01/08/29 22:10:54

  Modified:    .        CHANGES
               include  http_core.h
               server   core.c
  Log:
       Changed syntax of Set{Input|Output}Filter.  The list of filters
       must be semicolon delimited (if more than one filter is given.)
       The Set{Input|Output}Filter directive now overrides a parent
       container's directive (e.g. SetInputFilter in <Directory /web/foo>
       will override any SetInputFilter directive in <Directory /web>.)
       This new syntax is more consistent with Add{Input|Output}Filter
       directives defined in mod_mime.  Also cures a bug in prior releases
       where the Set{Input|Output}Filter directive would corrupt the
       global configuration if the multiple directives were nested.
       [William Rowe]
  
  Revision  Changes    Path
  1.347     +12 -1     httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.346
  retrieving revision 1.347
  diff -u -r1.346 -r1.347
  --- CHANGES	2001/08/30 04:11:56	1.346
  +++ CHANGES	2001/08/30 05:10:53	1.347
  @@ -1,6 +1,17 @@
   Changes with Apache 2.0.26-dev
   
  -  *) Cured what's ailed mime for quite some time ... if an AddSomething
  +  *) Changed syntax of Set{Input|Output}Filter.  The list of filters
  +     must be semicolon delimited (if more than one filter is given.)
  +     The Set{Input|Output}Filter directive now overrides a parent
  +     container's directive (e.g. SetInputFilter in <Directory /web/foo>
  +     will override any SetInputFilter directive in <Directory /web>.)
  +     This new syntax is more consistent with Add{Input|Output}Filter
  +     directives defined in mod_mime.  Also cures a bug in prior releases
  +     where the Set{Input|Output}Filter directive would corrupt the 
  +     global configuration if the multiple directives were nested.
  +     [William Rowe]
  +
  +  *) Cured what's ailed mime for quite some time.  If an AddSomething
        was given in the configuration (Language, Charset, Handler or
        Encoding) Apache would set the content type as given by AddType, 
        but refused to check the mime.types file if AddType wasn't given 
  
  
  
  1.51      +4 -4      httpd-2.0/include/http_core.h
  
  Index: http_core.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/http_core.h,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- http_core.h	2001/08/30 04:24:09	1.50
  +++ http_core.h	2001/08/30 05:10:53	1.51
  @@ -463,10 +463,10 @@
       interpreter_source_e script_interpreter_source;
   #endif    
   
  -    char *mime_type;                     /* forced with ForceType  */
  -    char *handler;                       /* forced with SetHandler */
  -    apr_array_header_t *output_filters;  /* forced with SetOutputFilters */
  -    apr_array_header_t *input_filters;   /* forced with SetInputFilters */
  +    const char *mime_type;       /* forced with ForceType  */
  +    const char *handler;         /* forced with SetHandler */
  +    const char *output_filters;  /* forced with SetOutputFilters */
  +    const char *input_filters;   /* forced with SetInputFilters */
   } core_dir_config;
   
   /* Per-server core configuration */
  
  
  
  1.54      +20 -40    httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- core.c	2001/08/30 04:24:09	1.53
  +++ core.c	2001/08/30 05:10:54	1.54
  @@ -164,8 +164,8 @@
        */
       conf->mime_type = NULL;
       conf->handler = NULL;
  -    conf->output_filters = apr_array_make(a, 2, sizeof(void *));
  -    conf->input_filters = apr_array_make(a, 2, sizeof(void *));
  +    conf->output_filters = NULL;
  +    conf->input_filters = NULL;
       return (void *)conf;
   }
   
  @@ -314,11 +314,12 @@
       if (new->handler) {
           conf->handler = new->handler;
       }
  -    conf->output_filters = apr_array_append(a, base->output_filters, 
  -                                             new->output_filters);
  -    conf->input_filters = apr_array_append(a, base->input_filters,
  -                                            new->input_filters);
  -
  +    if (new->output_filters) {
  +        conf->output_filters = new->output_filters;
  +    }
  +    if (new->input_filters) {
  +        conf->input_filters = new->input_filters;
  +    }
       return (void*)conf;
   }
   
  @@ -1875,26 +1876,6 @@
       return NULL;
   }
   
  -static const char *add_filter(cmd_parms *cmd, void *dummy, const char *arg)
  -{
  -    core_dir_config *conf = dummy;
  -    char **newfilter;
  -    
  -    newfilter = (char **)apr_array_push(conf->output_filters);
  -    *newfilter = apr_pstrdup(cmd->pool, arg);
  -    return NULL;
  -}
  -
  -static const char *add_input_filter(cmd_parms *cmd, void *dummy, const char *arg)
  -{
  -    core_dir_config *conf = dummy;
  -    char **newfilter;
  -    
  -    newfilter = (char **)apr_array_push(conf->input_filters);
  -    *newfilter = apr_pstrdup(cmd->pool, arg);
  -    return NULL;
  -}
  -
   static const char *set_server_string_slot(cmd_parms *cmd, void *dummy,
   					  const char *arg)
   {
  @@ -2837,10 +2818,12 @@
   AP_INIT_TAKE1("SetHandler", ap_set_string_slot_lower, 
          (void *)APR_XtOffsetOf(core_dir_config, handler), OR_FILEINFO,
      "a handler name that overrides any other configured handler"),
  -AP_INIT_ITERATE("SetOutputFilter", add_filter, NULL, OR_FILEINFO,
  -   "filters to be run"),
  -AP_INIT_ITERATE("SetInputFilter", add_input_filter, NULL, OR_FILEINFO,
  -   "filters to be run on the request body"),
  +AP_INIT_ITERATE("SetOutputFilter", ap_set_string_slot, 
  +       (void *)APR_XtOffsetOf(core_dir_config, output_filters), OR_FILEINFO,
  +   "filter (or ; delimited list of filters) to be run on the request content"),
  +AP_INIT_ITERATE("SetInputFilter", ap_set_string_slot, 
  +       (void *)APR_XtOffsetOf(core_dir_config, input_filters), OR_FILEINFO,
  +   "filter (or ; delimited list of filters) to be run on the request body"),
   
   /*
    * These are default configuration directives that mpms can/should
  @@ -3370,21 +3353,18 @@
   
   static void core_insert_filter(request_rec *r)
   {
  -    int i;
       core_dir_config *conf = (core_dir_config *)
                               ap_get_module_config(r->per_dir_config,
   						   &core_module); 
  -    char **items = (char **)conf->output_filters->elts;
  +    const char *filter, *filters = conf->output_filters;
   
  -    for (i = 0; i < conf->output_filters->nelts; i++) {
  -        char *foobar = items[i];
  -        ap_add_output_filter(foobar, NULL, r, r->connection);
  +    while (filter = ap_getword(r->pool, &filters, ';')) {
  +        ap_add_output_filter(filter, NULL, r, r->connection);
       }
   
  -    items = (char **)conf->input_filters->elts;
  -    for (i = 0; i < conf->input_filters->nelts; i++) {
  -        char *foobar = items[i];
  -        ap_add_input_filter(foobar, NULL, r, r->connection);
  +    filters = conf->input_filters;
  +    while (filter = ap_getword(r->pool, &filters, ';')) {
  +        ap_add_input_filter(filter, NULL, r, r->connection);
       }
   }
   
  
  
  

Mime
View raw message