]> granicus.if.org Git - apache/commitdiff
hook mimetype-forcing into fixup/LAST. This leads to consistent
authorAndré Malo <nd@apache.org>
Tue, 5 Aug 2003 23:04:05 +0000 (23:04 +0000)
committerAndré Malo <nd@apache.org>
Tue, 5 Aug 2003 23:04:05 +0000 (23:04 +0000)
behaviour (server context vs. directory context), overrides all statically
configured mime types and doesn't clobber multiviews any longer.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100913 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/mappers/mod_rewrite.c

diff --git a/CHANGES b/CHANGES
index 7fe007c2be1d8ce096c4106558a1d1054ac9a36e..3dcc150a6e325a69789b254fccbb26508dfecaea 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) mod_rewrite: RewriteRules in server context using the force
+     type feature [T=...] no longer disable MultiViews.  [André Malo]
+
   *) ab: Work over non-loopback on Unix again. PR 21495. [Jeff Trawick]
 
   *) mod_rewrite: In external rewrite maps lookup keys containing
index f8d267ea0ad83df5ec79861ef2cf1dfbdf7672e4..5a3c30b448d54cf59cb43acf74fb04002a2dcc9f 100644 (file)
@@ -3580,37 +3580,18 @@ static int apply_rewrite_rule(request_rec *r, rewriterule_entry *p,
      *  we stop processing and return immediately. The only thing
      *  we have not to forget are the environment variables and
      *  cookies:
-     *  (`RewriteRule <pat> - [E=...,CO=...]')
+     *  (`RewriteRule <pat> - [E=...,CO=...,T=...]')
      */
     if (output[0] == '-' && !output[1]) {
         do_expand_env(r, p->env, briRR, briRC);
         do_expand_cookie(r, p->cookie, briRR, briRC);
-        if (p->forced_mimetype != NULL) {
-            if (perdir == NULL) {
-                /* In the per-server context we can force the MIME-type
-                 * the correct way by notifying our MIME-type hook handler
-                 * to do the job when the MIME-type API stage is reached.
-                 */
-                rewritelog((r, 2, NULL, "remember %s to have MIME-type '%s'",
-                            r->filename, p->forced_mimetype));
-                apr_table_setn(r->notes, REWRITE_FORCED_MIMETYPE_NOTEVAR,
-                               p->forced_mimetype);
-            }
-            else {
-                /* In per-directory context we operate in the Fixup API hook
-                 * which is after the MIME-type hook, so our MIME-type handler
-                 * has no chance to set r->content_type. And because we are
-                 * in the situation where no substitution takes place no
-                 * sub-request will happen (which could solve the
-                 * restriction). As a workaround we do it ourself now
-                 * immediately although this is not strictly API-conforming.
-                 * But it's the only chance we have...
-                 */
-                rewritelog((r, 1, perdir, "force %s to have MIME-type '%s'",
-                            r->filename, p->forced_mimetype));
-                ap_set_content_type(r, p->forced_mimetype);
-            }
+        if (p->forced_mimetype) {
+            rewritelog((r, 2, perdir, "remember %s to have MIME-type '%s'",
+                        r->filename, p->forced_mimetype));
+            apr_table_setn(r->notes, REWRITE_FORCED_MIMETYPE_NOTEVAR,
+                           p->forced_mimetype);
         }
+
         return 2;
     }
 
@@ -4714,11 +4695,6 @@ static void register_hooks(apr_pool_t *p)
      */
     static const char * const aszPre[]={ "mod_proxy.c", NULL };
 
-    /* check type before mod_mime, so that [T=foo/bar] will not be
-     * overridden by AddType definitions.
-     */
-    static const char * const ct_aszSucc[]={ "mod_mime.c", NULL };
-
     APR_REGISTER_OPTIONAL_FN(ap_register_rewrite_mapfunc);
 
     ap_hook_handler(handler_redirect, NULL, NULL, APR_HOOK_MIDDLE);
@@ -4727,8 +4703,8 @@ static void register_hooks(apr_pool_t *p)
     ap_hook_child_init(init_child, NULL, NULL, APR_HOOK_MIDDLE);
 
     ap_hook_fixups(hook_fixup, aszPre, NULL, APR_HOOK_FIRST);
+    ap_hook_fixups(hook_mimetype, NULL, NULL, APR_HOOK_LAST);
     ap_hook_translate_name(hook_uri2file, NULL, NULL, APR_HOOK_FIRST);
-    ap_hook_type_checker(hook_mimetype, NULL, ct_aszSucc, APR_HOOK_MIDDLE);
 }
 
     /* the main config structure */