httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@hyperreal.org
Subject cvs commit: apache-1.3/src/modules/standard mod_mime.c
Date Fri, 23 Oct 1998 19:28:54 GMT
coar        98/10/23 12:28:54

  Modified:    .        STATUS
               src      CHANGES
               src/modules/standard mod_mime.c
  Log:
  	Allow selective dissociation of handlers from file extensions.
  
  PR:		1799
  Submitted by:	Ryan Bloom <rbbloom@us.ibm.com>
  Reviewed by:	Ken Coar
  
  Revision  Changes    Path
  1.520     +0 -12     apache-1.3/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/STATUS,v
  retrieving revision 1.519
  retrieving revision 1.520
  diff -u -r1.519 -r1.520
  --- STATUS	1998/10/21 16:00:42	1.519
  +++ STATUS	1998/10/23 19:28:50	1.520
  @@ -168,18 +168,6 @@
   	In particular this affects the correctness of the proxy and the
   	vhost mechanism.
   
  -    * PR#1799: we need to add a "default" or "none" handler to deal with
  -	filenames such as foo.map.gif which aren't image maps, and shouldn't
  -	be considered such.  See discussion in
  -	<Pine.LNX.3.96dg4.980220010131.20009H-100000@twinlark.arctic.org>
  -	<Pine.LNX.3.96.980220095126.10974A-100000@ecstasy.localnet>
  -	<34ED6E5A.29555AB8@Golux.Com>
  -	<34EECEB1.5AD015CF@Golux.Com>
  -	(feb98 archives)
  -	Jim: I thought that we decided "default", although Ken
  -	     thought it ugly
  -	Ken: I just don't like using "Add" when reverting something; not a -1
  -
       * proxy_*_canon routines use r->proxyreq incorrectly.  See
   	<Pine.LNX.3.96dg4.980304030057.13656O-100000@twinlark.arctic.org>
   
  
  
  
  1.1122    +4 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1121
  retrieving revision 1.1122
  diff -u -r1.1121 -r1.1122
  --- CHANGES	1998/10/23 19:06:24	1.1121
  +++ CHANGES	1998/10/23 19:28:51	1.1122
  @@ -1,5 +1,9 @@
   Changes with Apache 1.3.4
   
  +  *) Add a 'RemoveHandler' directive which will selectively remove
  +     all handler associations for the specified file extensions.
  +     [Ryan Bloom <rbbloom@us.ibm.com>] PR#1799.
  +
     *) Properly handle & allow "nul" and ".*/null" in AccessConfig and
        ResourceConfig directives on Win32.  Also add a note to the effect
        of 'useless User directive ignored on Win32' to the errorlog if
  
  
  
  1.45      +34 -1     apache-1.3/src/modules/standard/mod_mime.c
  
  Index: mod_mime.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_mime.c,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- mod_mime.c	1998/07/08 17:47:17	1.44
  +++ mod_mime.c	1998/10/23 19:28:53	1.45
  @@ -68,11 +68,16 @@
   #include "http_config.h"
   #include "http_log.h"
   
  +typedef struct handlers_info {
  +    char *name;
  +} handlers_info;
  +
   typedef struct {
       table *forced_types;        /* Additional AddTyped stuff */
       table *encoding_types;      /* Added with AddEncoding... */
       table *language_types;      /* Added with AddLanguage... */
       table *handlers;            /* Added with AddHandler...  */
  +    array_header *handlers_remove;     /* List of handlers to remove */
   
       char *type;                 /* Type forced with ForceType  */
       char *handler;              /* Handler forced with SetHandler */
  @@ -89,6 +94,7 @@
       new->encoding_types = ap_make_table(p, 4);
       new->language_types = ap_make_table(p, 4);
       new->handlers = ap_make_table(p, 4);
  +    new->handlers_remove = ap_make_array(p, 4, sizeof(handlers_info));
   
       new->type = NULL;
       new->handler = NULL;
  @@ -101,7 +107,14 @@
       mime_dir_config *base = (mime_dir_config *) basev;
       mime_dir_config *add = (mime_dir_config *) addv;
       mime_dir_config *new =
  -    (mime_dir_config *) ap_palloc(p, sizeof(mime_dir_config));
  +	(mime_dir_config *) ap_palloc(p, sizeof(mime_dir_config));
  +    int i;
  +    handlers_info *hand;
  +
  +    hand = (handlers_info *) add->handlers_remove->elts;
  +    for (i = 0; i < add->handlers_remove->nelts; i++) {
  +	ap_table_unset(base->handlers, hand[i].name);
  +    }
   
       new->forced_types = ap_overlay_tables(p, add->forced_types,
                                          base->forced_types);
  @@ -158,6 +171,24 @@
       return NULL;
   }
   
  +/*
  + * Note handler names that should be un-added for this location.  This
  + * will keep the association from being inherited, as well, but not
  + * from being re-added at a subordinate level.
  + */
  +static const char *remove_handler(cmd_parms *cmd, void *m, char *ext)
  +{
  +    mime_dir_config *mcfg = (mime_dir_config *) m;
  +    handlers_info *hand;
  +
  +    if (*ext == '.') {
  +	++ext;
  +    }
  +    hand = (handlers_info *) ap_push_array(mcfg->handlers_remove);
  +    hand->name = ap_pstrdup(cmd->pool, ext);
  +    return NULL;
  +}
  +
   /* The sole bit of server configuration that the MIME module has is
    * the name of its config file, so...
    */
  @@ -181,6 +212,8 @@
       {"ForceType", ap_set_string_slot_lower, 
        (void *)XtOffsetOf(mime_dir_config, type), OR_FILEINFO, TAKE1, 
        "a media type"},
  +    {"RemoveHandler", remove_handler, NULL, OR_FILEINFO, ITERATE,
  +     "one or more file extensions"},
       {"SetHandler", ap_set_string_slot_lower, 
        (void *)XtOffsetOf(mime_dir_config, handler), OR_FILEINFO, TAKE1, 
        "a handler name"},
  
  
  

Mime
View raw message