summaryrefslogtreecommitdiff
path: root/modules/http
diff options
context:
space:
mode:
authorEric Covener <covener@apache.org>2019-03-16 18:15:23 +0000
committerEric Covener <covener@apache.org>2019-03-16 18:15:23 +0000
commitdf8df5b5a6fc5b9887eecdeb3b524b9123bec544 (patch)
tree7078be327c4d538c866cdb780a8f1667a0c4b1b9 /modules/http
parent38facbddeaa14bf927832bc35275e5725d827f64 (diff)
downloadhttpd-df8df5b5a6fc5b9887eecdeb3b524b9123bec544.tar.gz
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
Diffstat (limited to 'modules/http')
-rw-r--r--modules/http/mod_mime.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/http/mod_mime.c b/modules/http/mod_mime.c
index 94672f228b..e951beedc1 100644
--- a/modules/http/mod_mime.c
+++ b/modules/http/mod_mime.c
@@ -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. */