You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Philippe M. Chiasson" <go...@cpan.org> on 2004/02/12 00:00:08 UTC

[Patch] ap_soak_end_container and argument-less directives

As can be seen with this simple config file:

<IfDefine not-defined>
<Location>
</Location>
</IfDefine>

$> httpd -f broken.conf
Syntax error on line 1 of broken.conf:
Expected </Location>> but saw </Location>

It's only a problem with <Blocks> without argument, i.e. <Perl> blocks
in mod_perl land.

It's a bug similar to this other one I found with directive-less <Block>
directive (http://marc.theaimsgroup.com/?t=106565148000001&r=1&w=2)

Index: server/config.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/config.c,v
retrieving revision 1.156.2.13
diff -u -I$Id -r1.156.2.13 config.c
--- server/config.c	9 Feb 2004 20:59:45 -0000	1.156.2.13
+++ server/config.c	11 Feb 2004 22:55:21 -0000
@@ -1287,6 +1287,10 @@
             else {
                 const char *msg;
 
+                if (*args == '\0' && cmd_name[strlen(cmd_name) - 1] == '>') {
+                    cmd_name[strlen(cmd_name) - 1] = '\0';
+                }
+
                 if ((msg = ap_soak_end_container(cmd, cmd_name)) != NULL) {
                     return msg;
                 }


Re: [Patch] ap_soak_end_container and argument-less directives

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Philippe M. Chiasson wrote:
> As can be seen with this simple config file:
> 
> <IfDefine not-defined>
> <Location>
> </Location>
> </IfDefine>
> 
> $> httpd -f broken.conf
> Syntax error on line 1 of broken.conf:
> Expected </Location>> but saw </Location>

<Location> with no arguments is a bug in and of itself and ought to be
fixed.  there was some discussion on this fairly recently

http://marc.theaimsgroup.com/?l=apache-httpd-dev&m=107089922728099&w=2

the rest of the thread goes on about how <IfDefine > is a popular hack, and
positions split on whether or not that is a good thing.

my most recent patch is here

http://marc.theaimsgroup.com/?l=apache-httpd-dev&m=107111613530796&w=2

which still sits kinda funny with me but at least tries to please everybody :)

so, comments here welcome :)

> 
> It's only a problem with <Blocks> without argument, i.e. <Perl> blocks
> in mod_perl land.

probably ought to be fixed, then :)

> +                if (*args == '\0' && cmd_name[strlen(cmd_name) - 1] == '>') {
> +                    cmd_name[strlen(cmd_name) - 1] = '\0';
> +                }
> +

seems reasonable enough, but one of the more hard-core parser-people ought
to take a look at it too.

--Geoff


Re: [Patch] ap_soak_end_container and argument-less directives

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Philippe M. Chiasson wrote:
> As can be seen with this simple config file:
> 
> <IfDefine not-defined>
> <Location>
> </Location>
> </IfDefine>
> 
> $> httpd -f broken.conf
> Syntax error on line 1 of broken.conf:
> Expected </Location>> but saw </Location>

ok, I tested your patch against the perl-framework and ran a few checks
against other containers as well (IfModule, etc).  everything tested ok so I
merged it into 2.1 and proposed for backport to 2.0.

nice work philippe :)

--Geoff


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [Patch] ap_soak_end_container and argument-less directives

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Philippe M. Chiasson wrote:
> As can be seen with this simple config file:
> 
> <IfDefine not-defined>
> <Location>
> </Location>
> </IfDefine>
> 
> $> httpd -f broken.conf
> Syntax error on line 1 of broken.conf:
> Expected </Location>> but saw </Location>

<Location> with no arguments is a bug in and of itself and ought to be
fixed.  there was some discussion on this fairly recently

http://marc.theaimsgroup.com/?l=apache-httpd-dev&m=107089922728099&w=2

the rest of the thread goes on about how <IfDefine > is a popular hack, and
positions split on whether or not that is a good thing.

my most recent patch is here

http://marc.theaimsgroup.com/?l=apache-httpd-dev&m=107111613530796&w=2

which still sits kinda funny with me but at least tries to please everybody :)

so, comments here welcome :)

> 
> It's only a problem with <Blocks> without argument, i.e. <Perl> blocks
> in mod_perl land.

probably ought to be fixed, then :)

> +                if (*args == '\0' && cmd_name[strlen(cmd_name) - 1] == '>') {
> +                    cmd_name[strlen(cmd_name) - 1] = '\0';
> +                }
> +

seems reasonable enough, but one of the more hard-core parser-people ought
to take a look at it too.

--Geoff


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [Patch] ap_soak_end_container and argument-less directives

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Philippe M. Chiasson wrote:
> As can be seen with this simple config file:
> 
> <IfDefine not-defined>
> <Location>
> </Location>
> </IfDefine>
> 
> $> httpd -f broken.conf
> Syntax error on line 1 of broken.conf:
> Expected </Location>> but saw </Location>

ok, I tested your patch against the perl-framework and ran a few checks
against other containers as well (IfModule, etc).  everything tested ok so I
merged it into 2.1 and proposed for backport to 2.0.

nice work philippe :)

--Geoff