httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stodd...@apache.org
Subject cvs commit: httpd-2.0 CHANGES
Date Wed, 20 Mar 2002 02:05:43 GMT
stoddard    02/03/19 18:05:43

  Modified:    include  http_core.h http_protocol.h
               server   core.c util_script.c
               .        CHANGES
  Log:
  Final commit to add ap_rset_content_type accessor. Add AddOutputFiltersbyType
  filters during call to ap_rset_content_type()
  
  Revision  Changes    Path
  1.64      +3 -0      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.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- http_core.h	13 Mar 2002 20:47:42 -0000	1.63
  +++ http_core.h	20 Mar 2002 02:05:42 -0000	1.64
  @@ -538,6 +538,9 @@
       apr_array_header_t *sec_url;
   } core_server_config;
   
  +/* for AddOutputFiltersByType in core.c */
  +void ap_add_output_filters_by_type(request_rec *r);
  +
   /* for http_config.c */
   void ap_core_reorder_directories(apr_pool_t *, server_rec *);
   
  
  
  
  1.72      +5 -0      httpd-2.0/include/http_protocol.h
  
  Index: http_protocol.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/http_protocol.h,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- http_protocol.h	19 Mar 2002 10:11:33 -0000	1.71
  +++ http_protocol.h	20 Mar 2002 02:05:42 -0000	1.72
  @@ -320,6 +320,11 @@
    */
   AP_DECLARE(void) ap_clear_method_list(ap_method_list_t *l);
       
  +/**
  + *
  + */
  +AP_DECLARE(void) ap_rset_content_type(char *str, request_rec *r);
  +
   /* Hmmm... could macrofy these for now, and maybe forever, though the
    * definitions of the macros would get a whole lot hairier.
    */
  
  
  
  1.164     +38 -32    httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.163
  retrieving revision 1.164
  diff -u -r1.163 -r1.164
  --- core.c	16 Mar 2002 18:26:58 -0000	1.163
  +++ core.c	20 Mar 2002 02:05:42 -0000	1.164
  @@ -2550,6 +2550,43 @@
   
       return NULL;
   }
  +/* 
  + * Insert filters requested by the AddOutputFiltersByType 
  + * configuration directive. We cannot add filters based 
  + * on content-type until after the handler has started 
  + * to run. Only then do we reliabily know the content-type.
  + */
  +void ap_add_output_filters_by_type(request_rec *r)
  +{
  +    core_dir_config *conf;
  +    const char *ctype, *ctypes;
  +
  +    conf = (core_dir_config *)ap_get_module_config(r->per_dir_config,
  +                                                   &core_module);
  +
  +    /* We can't do anything with proxy requests, no content-types or if
  +     * we don't have a filter configured.
  +     */
  +    if (r->proxyreq != PROXYREQ_NONE || !r->content_type ||
  +        !conf->ct_output_filters) {
  +        return;
  +    }
  +
  +    ctypes = r->content_type;
  +
  +    /* We must be able to handle decorated content-types.  */
  +    while (*ctypes && (ctype = ap_getword(r->pool, &ctypes, ';'))) {
  +        ap_filter_rec_t *ct_filter;
  +        ct_filter = apr_hash_get(conf->ct_output_filters, ctype,
  +                                 APR_HASH_KEY_STRING);
  +        while (ct_filter) {
  +            ap_add_output_filter(ct_filter->name, NULL, r, r->connection);
  +            ct_filter = ct_filter->next;
  +        }
  +    }
  +
  +    return;
  +}
   
   static apr_status_t writev_it_all(apr_socket_t *s,
                                     struct iovec *vec, int nvec,
  @@ -3058,7 +3095,7 @@
       /* Check for overrides with ForceType / SetHandler
        */
       if (conf->mime_type && strcmp(conf->mime_type, "none"))
  -        r->content_type = conf->mime_type;
  +        ap_rset_content_type((char*) conf->mime_type, r);
   
       if (conf->handler && strcmp(conf->handler, "none"))
           r->handler = conf->handler;
  @@ -3081,37 +3118,7 @@
       return OK;
   }
   
  -static int core_filters_type(request_rec *r)
  -{
  -    core_dir_config *conf;
  -    const char *ctype, *ctypes;
  -
  -    conf = (core_dir_config *)ap_get_module_config(r->per_dir_config,
  -                                                   &core_module);
  -
  -    /* We can't do anything with proxy requests, no content-types or if
  -     * we don't have a filter configured.
  -     */
  -    if (r->proxyreq != PROXYREQ_NONE || !r->content_type ||
  -        !conf->ct_output_filters) {
  -        return OK;
  -    }
  -
  -    ctypes = r->content_type;
  -
  -    /* We must be able to handle decorated content-types.  */
  -    while (*ctypes && (ctype = ap_getword(r->pool, &ctypes, ';'))) {
  -        ap_filter_rec_t *ct_filter;
  -        ct_filter = apr_hash_get(conf->ct_output_filters, ctype,
  -                                 APR_HASH_KEY_STRING);
  -        while (ct_filter) {
  -            ap_add_output_filter(ct_filter->name, NULL, r, r->connection);
  -            ct_filter = ct_filter->next;
  -        }
  -    }
   
  -    return OK;
  -}
   
   static int default_handler(request_rec *r)
   {
  @@ -4019,7 +4026,6 @@
       /* FIXME: I suspect we can eliminate the need for these do_nothings - Ben */
       ap_hook_type_checker(do_nothing,NULL,NULL,APR_HOOK_REALLY_LAST);
       ap_hook_fixups(core_override_type,NULL,NULL,APR_HOOK_REALLY_FIRST);
  -    ap_hook_fixups(core_filters_type,NULL,NULL,APR_HOOK_MIDDLE);
       ap_hook_access_checker(do_nothing,NULL,NULL,APR_HOOK_REALLY_LAST);
       ap_hook_create_request(core_create_req, NULL, NULL, APR_HOOK_MIDDLE);
       APR_OPTIONAL_HOOK(proxy, create_req, core_create_proxy_req, NULL, NULL,
  
  
  
  1.72      +1 -1      httpd-2.0/server/util_script.c
  
  Index: util_script.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/util_script.c,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- util_script.c	13 Mar 2002 20:48:01 -0000	1.71
  +++ util_script.c	20 Mar 2002 02:05:43 -0000	1.72
  @@ -569,7 +569,7 @@
   
   	    tmp = apr_pstrdup(r->pool, l);
   	    ap_content_type_tolower(tmp);
  -	    r->content_type = tmp;
  +	    ap_rset_content_type(tmp, r);
   	}
   	/*
   	 * If the script returned a specific status, that's what
  
  
  
  1.646     +5 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.645
  retrieving revision 1.646
  diff -u -r1.645 -r1.646
  --- CHANGES	19 Mar 2002 20:40:04 -0000	1.645
  +++ CHANGES	20 Mar 2002 02:05:43 -0000	1.646
  @@ -1,4 +1,9 @@
   Changes with Apache 2.0.34-dev
  +  *) Add accessor function to set r->content_type. From now on,
  +     ap_rset_content_type() should be used to set r->content_type.
  +     This change is required to properly implement the 
  +     AddOutputFilterByType configuration directive.
  +     [Bill Stoddard, Sander Striker, Ryan Bloom]
   
     *) Add new M_FOO symbols for the WebDAV/DeltaV methods specified by
        RFC 3253. Improved the method name/number mapping functions.
  
  
  

Mime
View raw message