httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@covalent.net>
Subject Re: cvs commit: httpd-2.0/modules/http mod_mime.c
Date Wed, 10 Oct 2001 16:14:37 GMT
From: "William A. Rowe, Jr." <wrowe@covalent.net>
Sent: Wednesday, October 10, 2001 12:40 AM


> From: "Greg Ames" <gregames@remulak.net>
> Sent: Tuesday, October 09, 2001 12:33 PM
> 
> > "William A. Rowe, Jr." wrote:
> > >
> > > What is the multiview mechanics?
> > 
> > K.I.S.S.  Why do we need multiviews for handlers etc?  Are any users
> > asking for this support?  What can I do with it that I can't do
> > otherwise?  How would the documentation for such a feature read?
> 
> MultiviewHandlerExtensions on|off
> MultiviewFilterExtensions on|off

Then how about this;

MultiviewsMatch NegotiatedOnly    [my preference]
MultiviewsMatch Handlers          [apache 1.3 behavior]
MultiviewsMatch Handlers Filters  [your preference]
MultiviewsMatch Filters           [why?  because you could :]

Does this solve our entire debate?

Bill



Index: modules/http/mod_mime.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/http/mod_mime.c,v
retrieving revision 1.65
diff -u -r1.65 mod_mime.c
--- modules/http/mod_mime.c 2001/10/09 01:45:20 1.65
+++ modules/http/mod_mime.c 2001/10/10 16:07:38
@@ -110,6 +110,11 @@
     char *output_filters;             /* Added with AddOutputFilter... */
 } extension_info;
 
+#define MULTIMATCH_UNSET      0
+#define MULTIMATCH_NEGOTIATED 1
+#define MULTIMATCH_HANDLERS   2
+#define MULTIMATCH_FILTERS    4
+
 typedef struct {
     apr_hash_t  *extension_mappings;  /* Map from extension name to
                                        * extension_info structure */
@@ -117,8 +122,10 @@
     apr_array_header_t *remove_mappings; /* A simple list, walked once */
 
     char *default_language;     /* Language if no AddLanguage ext found */
-                         /* Due to the FUD about JS and charsets 
-                                 * default_charset is actually in src/main */
+
+    int multimatch;       /* Extensions to include in multiview matching
+                           * for filenames, e.g. Filters and Handlers 
+                           */
 } mime_dir_config;
 
 typedef struct param_s {
@@ -151,6 +158,8 @@
 
     new->default_language = NULL;
 
+    new->multimatch = MULTIMATCH_UNSET;
+
     return new;
 }
 /*
@@ -267,6 +276,9 @@
     new->default_language = add->default_language ?
         add->default_language : base->default_language;
 
+    new->multimatch = (add->multimatch != MULTIMATCH_UNSET) ?
+        add->multimatch : base->multimatch;
+
     return new;
 }
 
@@ -337,6 +349,32 @@
     return NULL;
 }
 
+static const char *multiviews_match(cmd_parms *cmd, void *m_, 
+                                    const char *include)
+{
+    mime_dir_config *m = (mime_dir_config *) m_;
+
+    if (strcasecmp(include, "NegotiatedOnly") == 0) {
+        if (m->multimatch & ~MULTIMATCH_NEGOTIATED)
+            return "Negotiated is incompatible with Filters and Handlers";
+        m->multimatch |= MULTIMATCH_NEGOTIATED;
+    }
+    else if (strcasecmp(include, "Filters") == 0) {
+        if (m->multimatch & MULTIMATCH_NEGOTIATED)
+            return "Filters is incompatible with Negotiated";
+        m->multimatch |= MULTIMATCH_FILTERS;
+    }
+    else if (strcasecmp(include, "Handlers") == 0) {
+        if (m->multimatch & MULTIMATCH_NEGOTIATED)
+            return "Handlers is incompatible with Negotiated";
+        m->multimatch |= MULTIMATCH_HANDLERS;
+    }
+    else 
+        return "Unrecognized option";
+
+    return NULL;
+}
+
 static const command_rec mime_cmds[] =
 {
 AP_INIT_ITERATE2("AddCharset", add_extension_info, 
@@ -363,6 +401,8 @@
 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_ITERATE("MultiviewsMatch", multiviews_match, NULL, OR_FILEINFO,
+     "Handlers and/or Filters, or NegotiatedOnly (neither)"),
 AP_INIT_ITERATE("RemoveCharset", remove_extension_info, 
         (void *)APR_XtOffsetOf(extension_info, charset_type), OR_FILEINFO,
      "one or more file extensions"),
@@ -780,7 +820,8 @@
              */
             if (exinfo->handler && r->proxyreq == PROXYREQ_NONE) {
                 r->handler = exinfo->handler;
-                found = 1;
+                if (conf->multimatch & MULTIMATCH_HANDLERS)
+                    found = 1;
             }
             /* XXX Two significant problems; 1, we don't check to see if we are
              * setting redundant filters.    2, we insert these in the types config
@@ -792,7 +833,8 @@
                     && (filter = ap_getword(r->pool, &filters, ';'))) {
                     ap_add_input_filter(filter, NULL, r, r->connection);
                 }
-                found = 1;
+                if (conf->multimatch & MULTIMATCH_FILTERS)
+                    found = 1;
             }
             if (exinfo->output_filters && r->proxyreq == PROXYREQ_NONE) {
                 const char *filter, *filters = exinfo->output_filters;
@@ -800,7 +842,8 @@
                     && (filter = ap_getword(r->pool, &filters, ';'))) {
                     ap_add_output_filter(filter, NULL, r, r->connection);
                 }
-                found = 1;
+                if (conf->multimatch & MULTIMATCH_FILTERS)
+                    found = 1;
             }
         }
 



Mime
View raw message