coar 98/10/23 12:28:54
Modified: . STATUS
src CHANGES
src/modules/standard mod_mime.c
Log:
Allow selective dissociation of handlers from file extensions.
PR: 1799
Submitted by: Ryan Bloom <[EMAIL PROTECTED]>
Reviewed by: Ken Coar
Revision Changes Path
1.520 +0 -12 apache-1.3/STATUS
Index: STATUS
===================================================================
RCS file: /export/home/cvs/apache-1.3/STATUS,v
retrieving revision 1.519
retrieving revision 1.520
diff -u -r1.519 -r1.520
--- STATUS 1998/10/21 16:00:42 1.519
+++ STATUS 1998/10/23 19:28:50 1.520
@@ -168,18 +168,6 @@
In particular this affects the correctness of the proxy and the
vhost mechanism.
- * PR#1799: we need to add a "default" or "none" handler to deal with
- filenames such as foo.map.gif which aren't image maps, and shouldn't
- be considered such. See discussion in
- <[EMAIL PROTECTED]>
- <[EMAIL PROTECTED]>
- <[EMAIL PROTECTED]>
- <[EMAIL PROTECTED]>
- (feb98 archives)
- Jim: I thought that we decided "default", although Ken
- thought it ugly
- Ken: I just don't like using "Add" when reverting something; not a -1
-
* proxy_*_canon routines use r->proxyreq incorrectly. See
<[EMAIL PROTECTED]>
1.1122 +4 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.1121
retrieving revision 1.1122
diff -u -r1.1121 -r1.1122
--- CHANGES 1998/10/23 19:06:24 1.1121
+++ CHANGES 1998/10/23 19:28:51 1.1122
@@ -1,5 +1,9 @@
Changes with Apache 1.3.4
+ *) Add a 'RemoveHandler' directive which will selectively remove
+ all handler associations for the specified file extensions.
+ [Ryan Bloom <[EMAIL PROTECTED]>] PR#1799.
+
*) Properly handle & allow "nul" and ".*/null" in AccessConfig and
ResourceConfig directives on Win32. Also add a note to the effect
of 'useless User directive ignored on Win32' to the errorlog if
1.45 +34 -1 apache-1.3/src/modules/standard/mod_mime.c
Index: mod_mime.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_mime.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- mod_mime.c 1998/07/08 17:47:17 1.44
+++ mod_mime.c 1998/10/23 19:28:53 1.45
@@ -68,11 +68,16 @@
#include "http_config.h"
#include "http_log.h"
+typedef struct handlers_info {
+ char *name;
+} handlers_info;
+
typedef struct {
table *forced_types; /* Additional AddTyped stuff */
table *encoding_types; /* Added with AddEncoding... */
table *language_types; /* Added with AddLanguage... */
table *handlers; /* Added with AddHandler... */
+ array_header *handlers_remove; /* List of handlers to remove */
char *type; /* Type forced with ForceType */
char *handler; /* Handler forced with SetHandler */
@@ -89,6 +94,7 @@
new->encoding_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->type = NULL;
new->handler = NULL;
@@ -101,7 +107,14 @@
mime_dir_config *base = (mime_dir_config *) basev;
mime_dir_config *add = (mime_dir_config *) addv;
mime_dir_config *new =
- (mime_dir_config *) ap_palloc(p, sizeof(mime_dir_config));
+ (mime_dir_config *) ap_palloc(p, sizeof(mime_dir_config));
+ int i;
+ handlers_info *hand;
+
+ 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);
@@ -158,6 +171,24 @@
return NULL;
}
+/*
+ * Note handler names that should be un-added for this location. This
+ * will keep the association from being inherited, as well, but not
+ * from being re-added at a subordinate level.
+ */
+static const char *remove_handler(cmd_parms *cmd, void *m, char *ext)
+{
+ mime_dir_config *mcfg = (mime_dir_config *) m;
+ handlers_info *hand;
+
+ if (*ext == '.') {
+ ++ext;
+ }
+ hand = (handlers_info *) ap_push_array(mcfg->handlers_remove);
+ hand->name = ap_pstrdup(cmd->pool, ext);
+ return NULL;
+}
+
/* The sole bit of server configuration that the MIME module has is
* the name of its config file, so...
*/
@@ -181,6 +212,8 @@
{"ForceType", ap_set_string_slot_lower,
(void *)XtOffsetOf(mime_dir_config, type), OR_FILEINFO, TAKE1,
"a media type"},
+ {"RemoveHandler", remove_handler, NULL, OR_FILEINFO, ITERATE,
+ "one or more file extensions"},
{"SetHandler", ap_set_string_slot_lower,
(void *)XtOffsetOf(mime_dir_config, handler), OR_FILEINFO, TAKE1,
"a handler name"},