Commit 702d2c30 authored by Eric Covener's avatar Eric Covener
Browse files

allow mod_mime to be de disabled per-dir too


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1855663 13f79535-47bb-0310-9956-ffa450edef68
parent 9146f94b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -6,7 +6,8 @@ Changes with Apache 2.5.1
     configurations in <Location> or <Proxy> context. PR 63256. [Yann Ylavic]

  *) mod_mime: Add `MimeOptions` directive to allow Content-Type or all metadata
     detection to use only the last (right-most) file extension. [Eric Covener]
     detection to use only the last (right-most) file extension or to be
     disabled per-dir. [Eric Covener]

  *) MPMs unix: bind the bucket number of each child to its slot number, for a
     more efficient per bucket maintenance. [Yann Ylavic]
+5 −0
Original line number Diff line number Diff line
@@ -1082,6 +1082,11 @@ RemoveType .cgi
      <dd>This option can be used to revert to the default behavior of testing
      every filename extension when determining any response metadata
      (Content-Type, language, encoding, etc.) .</dd>
      <dt><code>Disable</code></dt>
      <dd>All assignment of metadata based on the filename is skipped.</dd>
      <dt><code>Enable</code></dt>
      <dd>Re-enables assignment of metadata based on the filename. Only useful if a lower
      precedence section has specified <code>MimeOptions Disable</code>.</dd>
    </dl>
</usage>
</directivesynopsis>
+16 −0
Original line number Diff line number Diff line
@@ -95,6 +95,8 @@ typedef struct {
    enum {CT_LAST_INIT, CT_LAST_ON, CT_LAST_OFF} ct_last_ext;
    /* Only use the final extension for anything */
    enum {ALL_LAST_INIT, ALL_LAST_ON, ALL_LAST_OFF} all_last_ext;
    /* don't do any detection */
    enum {NOMIME_INIT, NOMIME_ON, NOMIME_OFF} nomime;
} mime_dir_config;

typedef struct param_s {
@@ -251,6 +253,10 @@ static void *merge_mime_dir_configs(apr_pool_t *p, void *basev, void *addv)
    new->all_last_ext = (add->all_last_ext != ALL_LAST_INIT)
                           ? add->all_last_ext
                           : base->all_last_ext;
    new->nomime = (add->nomime != NOMIME_INIT)
                           ? add->nomime
                           : base->nomime;


    return new;
}
@@ -394,6 +400,12 @@ static const char *add_mime_options(cmd_parms *cmd, void *in_dc,
    else if (!strcasecmp(flag, "NoAllLastExtension")) {
        dc->all_last_ext = ALL_LAST_OFF;
    }
    else if (!strcasecmp(flag, "Disable")) {
        dc->nomime = NOMIME_ON;
    }
    else if (!strcasecmp(flag, "Enable")) {
        dc->nomime = NOMIME_OFF;
    }
    else {
        return apr_pstrcat(cmd->temp_pool,
                           "Invalid MimeOptions option: ",
@@ -814,6 +826,10 @@ static int find_ct(request_rec *r)

    conf = (mime_dir_config *)ap_get_module_config(r->per_dir_config,
                                                   &mime_module);
    if (conf->nomime == NOMIME_ON) {
        return DECLINED;
    }

    exception_list = apr_array_make(r->pool, 2, sizeof(char *));

    /* If use_path_info is explicitly set to on (value & 1 == 1), append. */