]> granicus.if.org Git - apache/commitdiff
Make RemoveType override the info from TypesConfig
authorStefan Fritsch <sf@apache.org>
Sat, 3 Oct 2009 12:13:41 +0000 (12:13 +0000)
committerStefan Fritsch <sf@apache.org>
Sat, 3 Oct 2009 12:13:41 +0000 (12:13 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@821298 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/http/mod_mime.c

diff --git a/CHANGES b/CHANGES
index 80d0c075b11ab67ad9ec6e9e8823df456378e945..39770e95b538ffebd5835f7df56141f95b5cf13f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -10,6 +10,9 @@ Changes with Apache 2.3.3
      mod_proxy_ftp: NULL pointer dereference on error paths.
      [Stefan Fritsch <sf fritsch.de>, Joe Orton]
 
+  *) mod_mime: Make RemoveType override the info from TypesConfig.
+     PR 38330. [Stefan Fritsch]
+
   *) mod_cache: Introduce the option to run the cache from within the
      normal request handler, and to allow fine grained control over
      where in the filter chain content is cached. [Graham Leggett]
index 95709766eb05a059167ab5a9a318151f73f656c3..3cde932e17ade56c657547f01cbb101c01727a0e 100644 (file)
@@ -273,6 +273,16 @@ static const char *add_extension_info(cmd_parms *cmd, void *m_,
     return NULL;
 }
 
+/*
+ * As RemoveType should also override the info from TypesConfig, we add an
+ * empty string as type instead of actually removing the type.
+ */
+static const char *remove_extension_type(cmd_parms *cmd, void *m_,
+                                         const char *ext)
+{
+    return add_extension_info(cmd, m_, "", ext);
+}
+
 /*
  * Note handler names are un-added with each per_dir_config merge.
  * This keeps the association from being inherited, but not
@@ -403,7 +413,7 @@ static const command_rec mime_cmds[] =
     AP_INIT_ITERATE("RemoveOutputFilter", remove_extension_info,
         (void *)APR_OFFSETOF(extension_info, output_filters), OR_FILEINFO,
         "one or more file extensions"),
-    AP_INIT_ITERATE("RemoveType", remove_extension_info,
+    AP_INIT_ITERATE("RemoveType", remove_extension_type,
         (void *)APR_OFFSETOF(extension_info, forced_type), OR_FILEINFO,
         "one or more file extensions"),
     AP_INIT_TAKE1("TypesConfig", set_types_config, NULL, RSRC_CONF,
@@ -819,7 +829,8 @@ static int find_ct(request_rec *r)
 
         if (exinfo != NULL) {
 
-            if (exinfo->forced_type) {
+            /* empty string is treated as special case for RemoveType */
+            if (exinfo->forced_type && *exinfo->forced_type) {
                 ap_set_content_type(r, exinfo->forced_type);
                 found = 1;
             }