You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2012/12/17 12:49:58 UTC

svn commit: r1422877 - in /httpd/httpd/branches/2.4.x: ./ CHANGES STATUS include/http_config.h server/core.c

Author: jim
Date: Mon Dec 17 11:49:56 2012
New Revision: 1422877

URL: http://svn.apache.org/viewvc?rev=1422877&view=rev
Log:
Merge r1406493, r1406495 from trunk:

Make <If> sections in virtual host context fill in cmd->path so that
other directive notice that they are in a config section.
    
This fixes LogLevel not working in <If> sections that are not in
Location/Directory/File sections.


Make ap_check_cmd_context() treat <If> sections like <File> sections.
This is necessary to properly disallow directives that don't work in
<If>.
    
A separate NOT_IN_IF flag may be nicer, but would create much more
hassle when being backported to 2.4.

Submitted by: sf
Reviewed/backported by: jim

Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/CHANGES
    httpd/httpd/branches/2.4.x/STATUS
    httpd/httpd/branches/2.4.x/include/http_config.h
    httpd/httpd/branches/2.4.x/server/core.c

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1406493,1406495

Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1422877&r1=1422876&r2=1422877&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Mon Dec 17 11:49:56 2012
@@ -2,6 +2,14 @@
 
 Changes with Apache 2.4.4
 
+  *) Be more correct about rejecting directives that cannot work in <If>
+     sections. [Stefan Fritsch]
+
+  *) core: Fix directives like LogLevel that need to know if they are invoked
+     at virtual host context or in Directory/Files/Location/If sections to
+     work properly in If sections that are not in a Directory/Files/Location.
+     [Stefan Fritsch]
+ 
   *) mod_xml2enc: Fix problems with charset conversion altering the
      Content-Length. [Micha Lenk <micha lenk info>]
 

Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1422877&r1=1422876&r2=1422877&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Mon Dec 17 11:49:56 2012
@@ -91,22 +91,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-   * <If>:
-     - Make <If> sections in virtual host context fill in cmd->path so that
-       other directive notice that they are in a config section.
-       Fixes directives like LogLevel that need to know if they are invoked
-       at virtual host context or in Directory/Files/Location/If sections to
-       work properly in If sections that are not in a Directory/Files/Location.
-     - Make ap_check_cmd_context() treat <If> sections like <File> sections.
-       This is necessary to properly disallow directives that don't work in
-       <If>.
-       A separate NOT_IN_IF flag may be nicer, but would create much more
-       hassle when being backported to 2.4.
-     trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1406493
-                  http://svn.apache.org/viewvc?view=revision&revision=1406495
-     2.4.x patch: Trunk patchs work.
-     +1: rjung, sf, jim
-
    * mod_cache: Install cache_common.h as required by mod_cache.h. Allows
      external modules to use mod_cache.
      trunk patch: http://svn.apache.org/viewvc?rev=1422855&view=rev

Modified: httpd/httpd/branches/2.4.x/include/http_config.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/include/http_config.h?rev=1422877&r1=1422876&r2=1422877&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/include/http_config.h (original)
+++ httpd/httpd/branches/2.4.x/include/http_config.h Mon Dec 17 11:49:56 2012
@@ -901,11 +901,11 @@ AP_DECLARE(const char *) ap_check_cmd_co
 #define  NOT_IN_LIMIT           0x02 /**< Forbidden in &lt;Limit&gt; */
 #define  NOT_IN_DIRECTORY       0x04 /**< Forbidden in &lt;Directory&gt; */
 #define  NOT_IN_LOCATION        0x08 /**< Forbidden in &lt;Location&gt; */
-#define  NOT_IN_FILES           0x10 /**< Forbidden in &lt;Files&gt; */
+#define  NOT_IN_FILES           0x10 /**< Forbidden in &lt;Files&gt; or &lt;If&gt;*/
 #define  NOT_IN_HTACCESS        0x20 /**< Forbidden in .htaccess files */
-/** Forbidden in &lt;Directory&gt;/&lt;Location&gt;/&lt;Files&gt;*/
+/** Forbidden in &lt;Directory&gt;/&lt;Location&gt;/&lt;Files&gt;&lt;If&gt;*/
 #define  NOT_IN_DIR_LOC_FILE    (NOT_IN_DIRECTORY|NOT_IN_LOCATION|NOT_IN_FILES)
-/** Forbidden in &lt;VirtualHost&gt;/&lt;Limit&gt;/&lt;Directory&gt;/&lt;Location&gt;/&lt;Files&gt; */
+/** Forbidden in &lt;VirtualHost&gt;/&lt;Limit&gt;/&lt;Directory&gt;/&lt;Location&gt;/&lt;Files&gt;/&lt;If&gt; */
 #define  GLOBAL_ONLY            (NOT_IN_VIRTUALHOST|NOT_IN_LIMIT|NOT_IN_DIR_LOC_FILE)
 
 /** @} */

Modified: httpd/httpd/branches/2.4.x/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/core.c?rev=1422877&r1=1422876&r2=1422877&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/core.c (original)
+++ httpd/httpd/branches/2.4.x/server/core.c Mon Dec 17 11:49:56 2012
@@ -1144,7 +1144,10 @@ AP_DECLARE(const char *) ap_check_cmd_co
                 || (found = find_parent(cmd->directive, "<LocationMatch"))))
         || ((forbidden & NOT_IN_FILES)
             && ((found = find_parent(cmd->directive, "<Files"))
-                || (found = find_parent(cmd->directive, "<FilesMatch"))))) {
+                || (found = find_parent(cmd->directive, "<FilesMatch"))
+                || (found = find_parent(cmd->directive, "<If"))
+                || (found = find_parent(cmd->directive, "<ElseIf"))
+                || (found = find_parent(cmd->directive, "<Else"))))) {
         return apr_pstrcat(cmd->pool, cmd->cmd->name, gt,
                            " cannot occur within ", found->directive,
                            "> section", NULL);
@@ -2354,7 +2357,11 @@ static const char *ifsection(cmd_parms *
 
     arg = apr_pstrndup(cmd->temp_pool, arg, endp - arg);
 
-
+    /*
+     * Set a dummy value so that other directives notice that they are inside
+     * a config section.
+     */
+    cmd->path = "*If";
     /* Only if not an .htaccess file */
     if (!old_path) {
         cmd->override = OR_ALL|ACCESS_CONF;