httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@locus.apache.org
Subject cvs commit: apache-1.3/htdocs/manual/mod directives.html mod_mime.html
Date Fri, 14 Jul 2000 17:34:35 GMT
coar        00/07/14 10:34:34

  Modified:    src      CHANGES
               src/modules/standard mod_mime.c
               htdocs/manual/mod directives.html mod_mime.html
  Log:
  	Add the RemoveType and RemoveEncoding directives to parallel the
  	RemoveHandler added in 1.3.4.  This can get us out of the sticky
  	problems we've had with .tar.gz and .tar.gz.asc files.
  
  Revision  Changes    Path
  1.1563    +7 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1562
  retrieving revision 1.1563
  diff -u -u -r1.1562 -r1.1563
  --- CHANGES	2000/07/03 15:24:22	1.1562
  +++ CHANGES	2000/07/14 17:34:29	1.1563
  @@ -1,5 +1,12 @@
   Changes with Apache 1.3.13
   
  +  *) Add new directives RemoveType and  RemoveEncoding to accompany the
  +     RemoveHandler directive added in 1.3.4.  AddType, AddEncoding, and
  +     AddHandler now all have corresponding 'undo' directives.  This allows
  +     things like marking foo.tar.gz.asc as *not* being gzipped, so it will be
  +     correctly interpreted as an unzipped signature of a gzipped file.
  +     [Ken Coar]
  +
     *) Win32 NT and 2000 services now capture stderr messages that occur
        before Apache's logs are opened to the Application Event Log.
        Console and Win9x services now hold the console open for 30 seconds
  
  
  
  1.55      +67 -17    apache-1.3/src/modules/standard/mod_mime.c
  
  Index: mod_mime.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_mime.c,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -u -r1.54 -r1.55
  --- mod_mime.c	2000/02/06 03:53:11	1.54
  +++ mod_mime.c	2000/07/14 17:34:32	1.55
  @@ -75,9 +75,9 @@
    */
   #define ap_isascii(c) ((OS_ASC(c) & 0x80) == 0)
   
  -typedef struct handlers_info {
  +typedef struct attrib_info {
       char *name;
  -} handlers_info;
  +} attrib_info;
   
   typedef struct {
       table *forced_types;        /* Additional AddTyped stuff */
  @@ -85,7 +85,9 @@
       table *charset_types;	/* Added with AddCharset... */
       table *language_types;      /* Added with AddLanguage... */
       table *handlers;            /* Added with AddHandler...  */
  -    array_header *handlers_remove;     /* List of handlers to remove */
  +    array_header *handlers_remove; /* List of handlers to remove */
  +    array_header *types_remove;	/* List of MIME types to remove */
  +    array_header *encodings_remove; /* List of encodings to remove */
   
       char *type;                 /* Type forced with ForceType  */
       char *handler;              /* Handler forced with SetHandler */
  @@ -122,7 +124,9 @@
       new->charset_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->handlers_remove = ap_make_array(p, 4, sizeof(attrib_info));
  +    new->types_remove = ap_make_array(p, 4, sizeof(attrib_info));
  +    new->encodings_remove = ap_make_array(p, 4, sizeof(attrib_info));
   
       new->type = NULL;
       new->handler = NULL;
  @@ -138,23 +142,31 @@
       mime_dir_config *new =
           (mime_dir_config *) ap_palloc(p, sizeof(mime_dir_config));
       int i;
  -    handlers_info *hand;
  +    attrib_info *suffix;
   
  -    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);
  +					  base->forced_types);
       new->encoding_types = ap_overlay_tables(p, add->encoding_types,
  -                                         base->encoding_types);
  +					    base->encoding_types);
       new->charset_types = ap_overlay_tables(p, add->charset_types,
   					   base->charset_types);
       new->language_types = ap_overlay_tables(p, add->language_types,
  -                                         base->language_types);
  +					    base->language_types);
       new->handlers = ap_overlay_tables(p, add->handlers,
  -                                   base->handlers);
  +				      base->handlers);
  +
  +    suffix = (attrib_info *) add->handlers_remove->elts;
  +    for (i = 0; i < add->handlers_remove->nelts; i++) {
  +        ap_table_unset(base->handlers, suffix[i].name);
  +    }
  +    suffix = (attrib_info *) add->types_remove->elts;
  +    for (i = 0; i < add->types_remove->nelts; i++) {
  +        ap_table_unset(base->forced_types, suffix[i].name);
  +    }
  +    suffix = (attrib_info *) add->encodings_remove->elts;
  +    for (i = 0; i < add->encodings_remove->nelts; i++) {
  +        ap_table_unset(base->encoding_types, suffix[i].name);
  +    }
   
       new->type = add->type ? add->type : base->type;
       new->handler = add->handler ? add->handler : base->handler;
  @@ -224,14 +236,48 @@
    */
   static const char *remove_handler(cmd_parms *cmd, void *m, char *ext)
   {
  +    mime_dir_config *mcfg = (mime_dir_config *) m;
  +    attrib_info *suffix;
  +
  +    if (*ext == '.') {
  +        ++ext;
  +    }
  +    suffix = (attrib_info *) ap_push_array(mcfg->handlers_remove);
  +    suffix->name = ap_pstrdup(cmd->pool, ext);
  +    return NULL;
  +}
  +
  +/*
  + * Just like the previous function, except that it records encoding
  + * associations to be undone.
  + */
  +static const char *remove_encoding(cmd_parms *cmd, void *m, char *ext)
  +{
  +    mime_dir_config *mcfg = (mime_dir_config *) m;
  +    attrib_info *suffix;
  +
  +    if (*ext == '.') {
  +        ++ext;
  +    }
  +    suffix = (attrib_info *) ap_push_array(mcfg->encodings_remove);
  +    suffix->name = ap_pstrdup(cmd->pool, ext);
  +    return NULL;
  +}
  +
  +/*
  + * Similar to the previous functions, except that it deals with filename
  + * suffix/MIME-type associations.
  + */
  +static const char *remove_type(cmd_parms *cmd, void *m, char *ext)
  +{
       mime_dir_config *mcfg = (mime_dir_config *) m;
  -    handlers_info *hand;
  +    attrib_info *suffix;
   
       if (*ext == '.') {
           ++ext;
       }
  -    hand = (handlers_info *) ap_push_array(mcfg->handlers_remove);
  -    hand->name = ap_pstrdup(cmd->pool, ext);
  +    suffix = (attrib_info *) ap_push_array(mcfg->types_remove);
  +    suffix->name = ap_pstrdup(cmd->pool, ext);
       return NULL;
   }
   
  @@ -261,6 +307,10 @@
        (void *)XtOffsetOf(mime_dir_config, type), OR_FILEINFO, TAKE1, 
        "a media type"},
       {"RemoveHandler", remove_handler, NULL, OR_FILEINFO, ITERATE,
  +     "one or more file extensions"},
  +    {"RemoveEncoding", remove_encoding, NULL, OR_FILEINFO, ITERATE,
  +     "one or more file extensions"},
  +    {"RemoveType", remove_type, NULL, OR_FILEINFO, ITERATE,
        "one or more file extensions"},
       {"SetHandler", ap_set_string_slot_lower, 
        (void *)XtOffsetOf(mime_dir_config, handler), OR_FILEINFO, TAKE1, 
  
  
  
  1.66      +2 -0      apache-1.3/htdocs/manual/mod/directives.html
  
  Index: directives.html
  ===================================================================
  RCS file: /home/cvs/apache-1.3/htdocs/manual/mod/directives.html,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -u -r1.65 -r1.66
  --- directives.html	2000/05/15 19:20:08	1.65
  +++ directives.html	2000/07/14 17:34:33	1.66
  @@ -173,7 +173,9 @@
   <LI><A HREF="mod_alias.html#redirecttemp">RedirectTemp</A>
   <LI><A HREF="mod_log_referer.html#refererignore">RefererIgnore</A>
   <LI><A HREF="mod_log_referer.html#refererlog">RefererLog</A>
  +<LI><A HREF="mod_mime.html#removeencoding">RemoveEncoding</A>
   <LI><A HREF="mod_mime.html#removehandler">RemoveHandler</A>
  +<LI><A HREF="mod_mime.html#removetype">RemoveType</A>
   <LI><A HREF="core.html#require">require</A>
   <LI><A HREF="core.html#resourceconfig">ResourceConfig</A>
   <LI><A HREF="mod_rewrite.html#RewriteBase">RewriteBase</A>
  
  
  
  1.41      +104 -1    apache-1.3/htdocs/manual/mod/mod_mime.html
  
  Index: mod_mime.html
  ===================================================================
  RCS file: /home/cvs/apache-1.3/htdocs/manual/mod/mod_mime.html,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -u -r1.40 -r1.41
  --- mod_mime.html	2000/05/28 02:09:18	1.40
  +++ mod_mime.html	2000/07/14 17:34:33	1.41
  @@ -93,7 +93,9 @@
   <LI><A HREF="#addtype">AddType</A>
   <LI><A HREF="#defaultlanguage">DefaultLanguage</A>
   <LI><A HREF="#forcetype">ForceType</A>
  +<LI><A HREF="#removeencoding">RemoveEncoding</A>
   <LI><A HREF="#removehandler">RemoveHandler</A>
  +<LI><A HREF="#removetype">RemoveType</A>
   <LI><A HREF="#sethandler">SetHandler</A>
   <LI><A HREF="#typesconfig">TypesConfig</A>
   </UL>
  @@ -468,12 +470,66 @@
   <P>Note that this will override any filename extensions that might determine
   the media type.</P><HR>
   
  +<H2><A NAME="removeencoding">RemoveEncoding</A></H2>
  +
  +<A
  + HREF="directive-dict.html#Syntax"
  + REL="Help"
  +><STRONG>Syntax:</STRONG></A> RemoveEncoding <i>extension [extension
...]</i><BR>
  +<A
  + HREF="directive-dict.html#Context"
  + REL="Help"
  +><STRONG>Context:</STRONG></A> directory, .htaccess<BR>
  +<A
  + HREF="directive-dict.html#Status"
  + REL="Help"
  +><STRONG>Status:</STRONG></A> Base<BR>
  +<A
  + HREF="directive-dict.html#Module"
  + REL="Help"
  +><STRONG>Module:</STRONG></A> mod_mime<BR>
  +<A
  + HREF="directive-dict.html#Compatibility"
  + REL="Help"
  +><STRONG>Compatibility:</STRONG></A> RemoveEncoding is only available
in Apache
  +1.3.13 and later.<P>
  +
  +<P>
  +The <SAMP>RemoveEncoding</SAMP> directive removes any
  +encoding associations for files with the given extensions.
  +This allows <CODE>.htaccess</CODE> files in subdirectories to undo
  +any associations inherited from parent directories or the server
  +config files.  An example of its use might be:
  +</P>
  +<DL>
  + <DT><CODE>/foo/.htaccess:</CODE></DT>
  + <DD><CODE>AddEncoding x-gzip .gz</CODE>
  +     <br>
  +     <code>AddType text/plain .asc</code>
  +     <br>
  +     <code>&lt;Files *.gz.asc&gt;</code>
  +     <br>
  +     <code>&nbsp;&nbsp;&nbsp;&nbsp;RemoveEncoding .gz</code>
  +     <br>
  +     <code>&lt;/Files&gt;</code></dd>
  +</DL>
  +<P>
  +This will cause <code>foo.gz</code> to mark as being encoded with the
  +gzip method, but <code>foo.gz.asc</code> as an unencoded plaintext file.
  +</P>
  +<p>
  +<b>Note:</b>RemoveEncoding directives are processed <i>after</i>
any
  +AddEncoding directives, so it is possible they may undo the effects
  +of the latter if both occur within the same directory configuration.
  +</p>
  +<HR>
  +
   <H2><A NAME="removehandler">RemoveHandler</A></H2>
   
   <A
    HREF="directive-dict.html#Syntax"
    REL="Help"
  -><STRONG>Syntax:</STRONG></A> RemoveHandler <EM>extension extension...</EM><BR>
  +><STRONG>Syntax:</STRONG></A> RemoveHandler <EM>extension [extension
...]</EM><BR>
   <A
    HREF="directive-dict.html#Context"
    REL="Help"
  @@ -511,6 +567,53 @@
   files, rather than as candidates for parsing (see the
   <A HREF="mod_include.html"><SAMP>mod_include</SAMP></A> module).
   </P>
  +<HR>
  +
  +<H2><A NAME="removetype">RemoveType</A></H2>
  +
  +<A
  + HREF="directive-dict.html#Syntax"
  + REL="Help"
  +><STRONG>Syntax:</STRONG></A> RemoveType <i>extension [extension
...]</i><BR>
  +<A
  + HREF="directive-dict.html#Context"
  + REL="Help"
  +><STRONG>Context:</STRONG></A> directory, .htaccess<BR>
  +<A
  + HREF="directive-dict.html#Status"
  + REL="Help"
  +><STRONG>Status:</STRONG></A> Base<BR>
  +<A
  + HREF="directive-dict.html#Module"
  + REL="Help"
  +><STRONG>Module:</STRONG></A> mod_mime<BR>
  +<A
  + HREF="directive-dict.html#Compatibility"
  + REL="Help"
  +><STRONG>Compatibility:</STRONG></A> RemoveType is only available
in Apache
  +1.3.13 and later.<P>
  +
  +<P>
  +The <SAMP>RemoveType</SAMP> directive removes any
  +MIME type associations for files with the given extensions.
  +This allows <CODE>.htaccess</CODE> files in subdirectories to undo
  +any associations inherited from parent directories or the server
  +config files.  An example of its use might be:
  +</P>
  +<DL>
  + <DT><CODE>/foo/.htaccess:</CODE></DT>
  + <DD><CODE>RemoveType .cgi</CODE></dd>
  +</DL>
  +<P>
  +This will remove any special handling of <code>.cgi</code> files in the
  +<code>/foo/</code> directory and any beneath it, causing the files to be
  +treated as being of the <a href="core.html#defaulttype">default type</a>.
  +</P>
  +<p>
  +<b>Note:</b><code>RemoveType</code> directives are processed <i>after</i>
any
  +<code>AddType</code> directives, so it is possible they may undo the effects
  +of the latter if both occur within the same directory configuration.
  +</p>
   <HR>
   
   <H2><A NAME="sethandler">SetHandler</A></H2>
  
  
  

Mime
View raw message