]> granicus.if.org Git - apache/commitdiff
Fix mod_mime skipping over mime.types when some _other_ field was set
authorWilliam A. Rowe Jr <wrowe@apache.org>
Thu, 30 Aug 2001 04:11:57 +0000 (04:11 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Thu, 30 Aug 2001 04:11:57 +0000 (04:11 +0000)
  with mod_mime, but not AddType.

  Why is everybody always breaking my local CHANGES file ;-?

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90796 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/http/mod_mime.c

diff --git a/CHANGES b/CHANGES
index 2c79a5d3b5c1e19cc4f4baad21d70e876dad58cd..5d9b6aca2b91671071b7a14bb5e0cc675d7dfb0d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,13 @@
 Changes with Apache 2.0.26-dev
 
+  *) 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 
+     for that specific extension.  Setting the AddHandler for .html 
+     without setting the AddType text/html html would cause Apache to 
+     use the default content type.  [William Rowe]
+
   *) Added some bulletproofing to memory allocation in the LDAP cache
      code. [Graham Leggett]
 
index 604208c2ddcb14904091ff63fef5b9a4d98d6591..6854dd8408319b486017dc046241c9d4ffb910ae 100644 (file)
@@ -116,8 +116,6 @@ typedef struct {
 
     apr_array_header_t *remove_mappings; /* A simple list, walked once */
 
-    char *type;                 /* Type forced with ForceType  */
-    char *handler;              /* Handler forced with SetHandler */
     char *default_language;     /* Language if no AddLanguage ext found */
                                /* Due to the FUD about JS and charsets 
                                  * default_charset is actually in src/main */
@@ -151,8 +149,6 @@ static void *create_mime_dir_config(apr_pool_t *p, char *dummy)
     new->extension_mappings = NULL;
     new->remove_mappings = NULL;
 
-    new->type = NULL;
-    new->handler = NULL;
     new->default_language = NULL;
 
     return new;
@@ -262,8 +258,6 @@ static void *merge_mime_dir_configs(apr_pool_t *p, void *basev, void *addv)
     }
     new->remove_mappings = NULL;
 
-    new->type = add->type ? add->type : base->type;
-    new->handler = add->handler ? add->handler : base->handler;
     new->default_language = add->default_language ?
         add->default_language : base->default_language;
 
@@ -350,22 +344,19 @@ AP_INIT_ITERATE2("AddHandler", add_extension_info,
      "a handler name followed by one or more file extensions"),
 AP_INIT_ITERATE2("AddInputFilter", add_extension_info, 
          (void *)APR_XtOffsetOf(extension_info, input_filters), OR_FILEINFO,
-     "a handler name followed by one or more file extensions"),
+     "input filter name (or ; delimited names) followed by one or more file extensions"),
 AP_INIT_ITERATE2("AddLanguage", add_extension_info, 
          (void *)APR_XtOffsetOf(extension_info, language_type), OR_FILEINFO,
      "a language (e.g., fr), followed by one or more file extensions"),
 AP_INIT_ITERATE2("AddOutputFilter", add_extension_info, 
          (void *)APR_XtOffsetOf(extension_info, output_filters), OR_FILEINFO, 
-     "a mime type followed by one or more file extensions"),
+     "output filter name (or ; delimited names) followed by one or more file extensions"),
 AP_INIT_ITERATE2("AddType", add_extension_info, 
          (void *)APR_XtOffsetOf(extension_info, forced_type), OR_FILEINFO, 
      "a mime type followed by one or more file extensions"),
 AP_INIT_TAKE1("DefaultLanguage", ap_set_string_slot,
        (void*)APR_XtOffsetOf(mime_dir_config, default_language), OR_FILEINFO,
      "language to use for documents with no other language file extension"),
-AP_INIT_TAKE1("ForceType", ap_set_string_slot_lower, 
-       (void *)APR_XtOffsetOf(mime_dir_config, type), OR_FILEINFO,
-     "a media type"),
 AP_INIT_ITERATE("RemoveCharset", remove_extension_info, 
         (void *)APR_XtOffsetOf(extension_info, charset_type), OR_FILEINFO,
      "one or more file extensions"),
@@ -387,9 +378,6 @@ AP_INIT_ITERATE("RemoveOutputFilter", remove_extension_info,
 AP_INIT_ITERATE("RemoveType", remove_extension_info, 
         (void *)APR_XtOffsetOf(extension_info, forced_type), OR_FILEINFO,
      "one or more file extensions"),
-AP_INIT_TAKE1("SetHandler", ap_set_string_slot_lower, 
-       (void *)APR_XtOffsetOf(mime_dir_config, handler), OR_FILEINFO,
-     "a handler name"),
 AP_INIT_TAKE1("TypesConfig", set_types_config, NULL, RSRC_CONF,
      "the MIME types config file"),
     {NULL}
@@ -740,19 +728,21 @@ static int find_ct(request_rec *r)
                                                    ext, APR_HASH_KEY_STRING);
         }
 
-        if (exinfo == NULL) {
+        if (exinfo == NULL || !exinfo->forced_type) {
             if ((type = apr_hash_get(mime_type_extensions, ext,
                                      APR_HASH_KEY_STRING)) != NULL) {
                 r->content_type = type;
                 found = 1;
             }
         }
-        else {
+
+        if (exinfo != NULL) {
 
             if (exinfo->forced_type) {
                 r->content_type = exinfo->forced_type;
                 found = 1;
             }
+
             if (exinfo->charset_type) {
                 charset = exinfo->charset_type;
                 found = 1;
@@ -874,13 +864,6 @@ static int find_ct(request_rec *r)
         *new = conf->default_language;
     }
 
-    /* Check for overrides with ForceType/SetHandler */
-
-    if (conf->type && strcmp(conf->type, "none"))
-        r->content_type = conf->type;
-    if (conf->handler && strcmp(conf->handler, "none"))
-        r->handler = conf->handler;
-
     if (!r->content_type)
         return DECLINED;