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 2015/01/30 18:17:12 UTC

svn commit: r1656063 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/core.xml server/core.c

Author: covener
Date: Fri Jan 30 17:17:12 2015
New Revision: 1656063

URL: http://svn.apache.org/r1656063
Log:
Block Define/Undefine from per-directory context, because they will
fire while the block is read not when it evaluates for a given
request.


Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/docs/manual/mod/core.xml
    httpd/httpd/trunk/server/core.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1656063&r1=1656062&r2=1656063&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Fri Jan 30 17:17:12 2015
@@ -1,6 +1,11 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) core: Define and UnDefine are no longer permitted in
+     directory context. Previously they would always be evaulated
+     as the configuration was read without regard for the directory
+     context. [Eric Covener]
+
   *) config: For directives that do not expect any arguments, enforce
      that none are specified in the configuration file. 
      [Joachim Zobel <jzobel heute-morgen.de>, Eric Covener]

Modified: httpd/httpd/trunk/docs/manual/mod/core.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/core.xml?rev=1656063&r1=1656062&r2=1656063&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/core.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/core.xml Fri Jan 30 17:17:12 2015
@@ -717,7 +717,7 @@ which no other media type configuration
 <description>Define a variable</description>
 <syntax>Define <var>parameter-name</var> [<var>parameter-value</var>]</syntax>
 <contextlist><context>server config</context><context>virtual host</context>
-<context>directory</context></contextlist>
+</contextlist>
 
 <usage>
     <p>In its one parameter form, <directive>Define</directive> is equivalent
@@ -746,6 +746,10 @@ DocumentRoot /var/www/${servername}/htdo
 
     <p>Variable names may not contain colon ":" characters, to avoid clashes
     with <directive module="mod_rewrite">RewriteMap</directive>'s syntax.</p>
+
+    <p>While this directive is supported in virtual host context,
+       the changes it makes are visible to any later configuration
+       directives, beyond any enclosing virtual host</p>
 </usage>
 </directivesynopsis>
 
@@ -4291,7 +4295,8 @@ certain events before failing a request<
 <name>UnDefine</name>
 <description>Undefine the existence of a variable</description>
 <syntax>UnDefine <var>parameter-name</var></syntax>
-<contextlist><context>server config</context></contextlist>
+<contextlist><context>server config</context>
+<context>virtual host</context></contextlist>
 
 <usage>
     <p>Undoes the effect of a <directive module="core">Define</directive> or
@@ -4299,6 +4304,9 @@ certain events before failing a request<
     <p>This directive can be used to toggle the use of <directive module="core"
     type="section">IfDefine</directive> sections without needing to alter
     <code>-D</code> arguments in any startup scripts.</p>
+    <p>While this directive is supported in virtual host context,
+       the changes it makes are visible to any later configuration
+       directives, beyond any enclosing virtual host</p>
 </usage>
 </directivesynopsis>
 

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1656063&r1=1656062&r2=1656063&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Fri Jan 30 17:17:12 2015
@@ -1332,9 +1332,10 @@ static void init_config_defines(apr_pool
 static const char *set_define(cmd_parms *cmd, void *dummy,
                               const char *name, const char *value)
 {
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_HTACCESS);
-    if (err)
-        return err;
+    if (cmd->parent && strcasecmp(cmd->parent->directive, "<VirtualHost")) { 
+        return apr_pstrcat(cmd->pool, "Define is not valid in ", cmd->parent->directive, " context", NULL);
+    }
+
     if (ap_strchr_c(name, ':') != NULL)
         return "Variable name must not contain ':'";
 
@@ -1358,9 +1359,10 @@ static const char *unset_define(cmd_parm
 {
     int i;
     char **defines;
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_HTACCESS);
-    if (err)
-        return err;
+    if (cmd->parent && strcasecmp(cmd->parent->directive, "<VirtualHost")) { 
+        return apr_pstrcat(cmd->pool, "Define is not valid in ", cmd->parent->directive, " context", NULL);
+    }
+
     if (ap_strchr_c(name, ':') != NULL)
         return "Variable name must not contain ':'";
 
@@ -4181,9 +4183,9 @@ AP_INIT_TAKE1("AddDefaultCharset", set_a
   "The name of the default charset to add to any Content-Type without one or 'Off' to disable"),
 AP_INIT_TAKE1("AcceptPathInfo", set_accept_path_info, NULL, OR_FILEINFO,
   "Set to on or off for PATH_INFO to be accepted by handlers, or default for the per-handler preference"),
-AP_INIT_TAKE12("Define", set_define, NULL, EXEC_ON_READ|ACCESS_CONF|RSRC_CONF,
+AP_INIT_TAKE12("Define", set_define, NULL, EXEC_ON_READ|RSRC_CONF,
               "Define a variable, optionally to a value.  Same as passing -D to the command line."),
-AP_INIT_TAKE1("UnDefine", unset_define, NULL, EXEC_ON_READ|ACCESS_CONF|RSRC_CONF,
+AP_INIT_TAKE1("UnDefine", unset_define, NULL, EXEC_ON_READ|RSRC_CONF,
               "Undefine the existence of a variable. Undo a Define."),
 AP_INIT_RAW_ARGS("Error", generate_message, (void*) APLOG_ERR, OR_ALL,
                  "Generate error message from within configuration."),



Re: svn commit: r1656063 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/core.xml server/core.c

Posted by Eric Covener <co...@gmail.com>.
On Fri, Jan 30, 2015 at 4:03 PM, Yann Ylavic <yl...@gmail.com> wrote:
> Typo: s/Define/Undefine/ or maybe s/"Define/cmd->cmd->name, "/ in both

thanks, r1656122.

Re: svn commit: r1656063 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/core.xml server/core.c

Posted by Yann Ylavic <yl...@gmail.com>.
On Fri, Jan 30, 2015 at 6:17 PM,  <co...@apache.org> wrote:
> Author: covener
> Date: Fri Jan 30 17:17:12 2015
> New Revision: 1656063
>
> URL: http://svn.apache.org/r1656063
> Log:
> Block Define/Undefine from per-directory context, because they will
> fire while the block is read not when it evaluates for a given
> request.
>
[...]
> Modified: httpd/httpd/trunk/server/core.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1656063&r1=1656062&r2=1656063&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/server/core.c (original)
> +++ httpd/httpd/trunk/server/core.c Fri Jan 30 17:17:12 2015
[...]
> @@ -1358,9 +1359,10 @@ static const char *unset_define(cmd_parm
>  {
>      int i;
>      char **defines;
> -    const char *err = ap_check_cmd_context(cmd, NOT_IN_HTACCESS);
> -    if (err)
> -        return err;
> +    if (cmd->parent && strcasecmp(cmd->parent->directive, "<VirtualHost")) {
> +        return apr_pstrcat(cmd->pool, "Define is not valid in ", cmd->parent->directive, " context", NULL);

Typo: s/Define/Undefine/ or maybe s/"Define/cmd->cmd->name, "/ in both
set_define() and unset_define().

> +    }
> +

Regards,
Yann.