You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2011/02/08 03:48:16 UTC

svn commit: r1068255 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS modules/http/http_request.c server/core.c

Author: covener
Date: Tue Feb  8 02:48:16 2011
New Revision: 1068255

URL: http://svn.apache.org/viewvc?rev=1068255&view=rev
Log:
backport r1043023 from trunk:

    PR50349: Honor 'AcceptPathInfo OFF' during internal redirects,
    such as per-directory mod_rewrite substitutions.   This would be left floating 
    around in the request_rec with a pcalloc'ed value, so the core fixup
    hook thought some module had overridden it.

Reviwed by: covener, rpluem, jorton


Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/modules/http/http_request.c
    httpd/httpd/branches/2.2.x/server/core.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=1068255&r1=1068254&r2=1068255&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Tue Feb  8 02:48:16 2011
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.2.18
 
+  *) core: Honor 'AcceptPathInfo OFF' during internal redirects,
+     such as per-directory mod_rewrite substitutions.  PR 50349.
+     [Eric Covener]
+
   *) mod_cache: Check the request to determine whether we are allowed
      to return cached content at all, and respect a "Cache-Control:
      no-cache" header from a client. Previously, "no-cache" would

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=1068255&r1=1068254&r2=1068255&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Tue Feb  8 02:48:16 2011
@@ -98,14 +98,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
      2.2.x patch: http://people.apache.org/~minfrin/httpd-mod_cache-304-fix-2.patch
      +1: minfrin, jim, covener
 
-   * core: honor "AcceptPathInfo OFF" for internal redirects, such as those
-     generated by mod_rewrite in per-dir context.  This would be left floating
-     around in the request_rec with a pcalloc'ed value, so the core fixup
-     hook thought some module had overridden it. PR 50349.
-     Trunk patch: http://svn.apache.org/viewvc?rev=1043023&view=rev
-     2.2.x patch: http://people.apache.org/~covener/patches/2.2.x-accept_pathinfo_redir.diff
-    +1 covener, rpluem, jorton
-
    * mod_dav: If a malformed Content-Range header is received for a PUT request,
      we must not use the supplied content per RFC 2616 14.16. Send 400 response
      instead of ignoring the Content-Range.

Modified: httpd/httpd/branches/2.2.x/modules/http/http_request.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/http/http_request.c?rev=1068255&r1=1068254&r2=1068255&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/http/http_request.c (original)
+++ httpd/httpd/branches/2.2.x/modules/http/http_request.c Tue Feb  8 02:48:16 2011
@@ -447,6 +447,11 @@ static request_rec *internal_internal_re
     apr_table_setn(new->subprocess_env, "REDIRECT_STATUS",
                    apr_itoa(r->pool, r->status));
 
+    /* Begin by presuming any module can make its own path_info assumptions,
+     * until some module interjects and changes the value.
+     */
+    new->used_path_info = AP_REQ_DEFAULT_PATH_INFO;
+
     /*
      * XXX: hmm.  This is because mod_setenvif and mod_unique_id really need
      * to do their thing on internal redirects as well.  Perhaps this is a

Modified: httpd/httpd/branches/2.2.x/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/server/core.c?rev=1068255&r1=1068254&r2=1068255&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/server/core.c (original)
+++ httpd/httpd/branches/2.2.x/server/core.c Tue Feb  8 02:48:16 2011
@@ -66,6 +66,9 @@
 #define AP_MAX_INCLUDE_DEPTH            (128)
 #endif
 
+/* valid in core-conf, but not in runtime r->used_path_info */
+#define AP_ACCEPT_PATHINFO_UNSET 3 
+
 APR_HOOK_STRUCT(
     APR_HOOK_LINK(get_mgmt_items)
 )
@@ -114,7 +117,7 @@ static void *create_core_dir_config(apr_
     conf->override_opts = OPT_UNSET | OPT_ALL | OPT_SYM_OWNER | OPT_MULTI;
 
     conf->content_md5 = 2;
-    conf->accept_path_info = 3;
+    conf->accept_path_info = AP_ACCEPT_PATHINFO_UNSET;
 
     conf->use_canonical_name = USE_CANONICAL_NAME_UNSET;
     conf->use_canonical_phys_port = USE_CANONICAL_PHYS_PORT_UNSET;
@@ -3596,15 +3599,17 @@ static int core_override_type(request_re
     /* Deal with the poor soul who is trying to force path_info to be
      * accepted within the core_handler, where they will let the subreq
      * address its contents.  This is toggled by the user in the very
-     * beginning of the fixup phase, so modules should override the user's
+     * beginning of the fixup phase (here!), so modules should override the user's
      * discretion in their own module fixup phase.  It is tristate, if
-     * the user doesn't specify, the result is 2 (which the module may
-     * interpret to its own customary behavior.)  It won't be touched
-     * if the value is no longer undefined (2), so any module changing
-     * the value prior to the fixup phase OVERRIDES the user's choice.
+     * the user doesn't specify, the result is AP_REQ_DEFAULT_PATH_INFO.
+     * (which the module may interpret to its own customary behavior.)  
+     * It won't be touched if the value is no longer AP_ACCEPT_PATHINFO_UNSET,
+     * so any module changing the value prior to the fixup phase 
+     * OVERRIDES the user's choice.
      */
     if ((r->used_path_info == AP_REQ_DEFAULT_PATH_INFO)
-        && (conf->accept_path_info != 3)) {
+        && (conf->accept_path_info != AP_ACCEPT_PATHINFO_UNSET)) {
+        /* No module knew better, and the user coded AcceptPathInfo */
         r->used_path_info = conf->accept_path_info;
     }