You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Francis GALIEGUE <fg...@one2team.com> on 2009/12/04 14:18:09 UTC

Re: [users@httpd] Re: Ampersand extends to the left part of regexes with RewriteRule, RedirectMatch and SetEnvIf: is that expected?

On Fri, Dec 4, 2009 at 14:07, André Warnier <aw...@ice-sa.com> wrote:
[...]
> First, I believe that one mistake is to include the trailing question mark
> into the URL which you redirect.
> In http://my.server.com/foo/?var1=val1...
> The "?" is not actually part of the URI. It is a separator between the URI
> and the query string. So the URI to test is "/foo/", and not "/foo/?".
> Second, in "RedirectMatch", "RewriteCond" and "RewriteRule", the argument is
> a regexp, not a string. So when you write "/foo/?$", you mean actually :
> "/foo", possibly followed by "/", followed by the end of the string.
> If you really wanted to test for a "?", you would have to escape it as "\?".
>
> I do not know if this is the source of your particular problem, but it may
> contribute to the strange results which you are seeing later.
>

No, the ? is intended, I want to match either /foo or /foo/, so
^/foo/?$ is the correct regex, I'm sure about that.

The problem I have is with the & being systematically understood by
the right size of regexes to mean "the whole thing matched by the
matching left regex". While this is a common regex idiom in "basic"
regexes (sed acts this way for instance), it is not expected at all
from pcre (Perl doesn't know about &, and from what I've read about
pcre so far, pcre doesn't know about it either). Hence my puzzle.

-- 

Francis Galiegue
ONE2TEAM
Ingénieur système
Mob : +33 (0) 683 877 875
Tel : +33 (0) 178 945 552
fge@one2team.com
40 avenue Raymond Poincaré
75116 Paris

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Ampersand extends to the left part of regexes with RewriteRule, RedirectMatch and SetEnvIf: is that expected?

Posted by Eric Covener <co...@gmail.com>.
On Tue, Dec 8, 2009 at 1:49 PM, Nick Kew <ni...@webthing.com> wrote:
> Rich Bowen wrote:
>
>>> If I file an issue on Apache's Bugzilla, will this be considered a bug?
>>
>> Please do submit it, but perhaps as a documentation bug? I'll try to
>> remember to add a mention of this to the documentation, but a bugzilla
>> ticket will help us remember.
>
> Is this really an Apache docs issue?  It's down to the regexp library,
> so surely the correct documentation for httpd is a reference to PCRE
> (or Perl regexp) documentation?

Searching for this old thread, missed your followup niq.  httpd was
stepping in the way and treating & as an alias for \0/$0 (entire
match):

http://svn.apache.org/viewvc?view=revision&revision=904765

There was some confusion ITT that Rewrite and mod_alias directives
were behaving the same way that I think was cleared up elsewhere.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Ampersand extends to the left part of regexes with RewriteRule, RedirectMatch and SetEnvIf: is that expected?

Posted by Nick Kew <ni...@webthing.com>.
Rich Bowen wrote:

>> If I file an issue on Apache's Bugzilla, will this be considered a bug?
> 
> Please do submit it, but perhaps as a documentation bug? I'll try to 
> remember to add a mention of this to the documentation, but a bugzilla 
> ticket will help us remember.

Is this really an Apache docs issue?  It's down to the regexp library,
so surely the correct documentation for httpd is a reference to PCRE
(or Perl regexp) documentation?

Apache could put this in a tutorial/guide, but not really in
reference docs.  Is that what you meant?

-- 
Nick Kew

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Ampersand extends to the left part of regexes with RewriteRule, RedirectMatch and SetEnvIf: is that expected?

Posted by Rich Bowen <rb...@rcbowen.com>.
On Dec 8, 2009, at 08:20 , Francis GALIEGUE wrote:

> On Fri, Dec 4, 2009 at 14:39, Eric Covener <co...@gmail.com> wrote:
> [...]
>>>
>>> I think Apache is simulating perls $&, and I think it's on purpose.
>>>  Seems pretty unwise.
>>
>> That is definitely the case.
>>
>
> If I file an issue on Apache's Bugzilla, will this be considered a  
> bug?

Please do submit it, but perhaps as a documentation bug? I'll try to  
remember to add a mention of this to the documentation, but a bugzilla  
ticket will help us remember.

--
Rich Bowen
rbowen@rcbowen.com




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Ampersand extends to the left part of regexes with RewriteRule, RedirectMatch and SetEnvIf: is that expected?

Posted by Eric Covener <co...@gmail.com>.
On Tue, Dec 8, 2009 at 8:20 AM, Francis GALIEGUE <fg...@one2team.com> wrote:
> On Fri, Dec 4, 2009 at 14:39, Eric Covener <co...@gmail.com> wrote:
> [...]
>>>
>>> I think Apache is simulating perls $&, and I think it's on purpose.
>>>  Seems pretty unwise.
>>
>> That is definitely the case.
>>
>
> If I file an issue on Apache's Bugzilla, will this be considered a bug?

I'm still a little lost here as to why this isn't more of a FAQ if it
impacts including an ampersand in any RewriteRule substitution, so I
may be wrong in the analysis.

It's minimally a documentation bug.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Ampersand extends to the left part of regexes with RewriteRule, RedirectMatch and SetEnvIf: is that expected?

Posted by Francis GALIEGUE <fg...@one2team.com>.
On Fri, Dec 4, 2009 at 14:39, Eric Covener <co...@gmail.com> wrote:
[...]
>>
>> I think Apache is simulating perls $&, and I think it's on purpose.
>>  Seems pretty unwise.
>
> That is definitely the case.
>

If I file an issue on Apache's Bugzilla, will this be considered a bug?

-- 

Francis Galiegue
ONE2TEAM
Ingénieur système
Mob : +33 (0) 683 877 875
Tel : +33 (0) 178 945 552
fge@one2team.com
40 avenue Raymond Poincaré
75116 Paris

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Ampersand extends to the left part of regexes with RewriteRule, RedirectMatch and SetEnvIf: is that expected?

Posted by Eric Covener <co...@gmail.com>.
On 12/4/09, Eric Covener <co...@gmail.com> wrote:
> On 12/4/09, Francis GALIEGUE <fg...@one2team.com> wrote:
>
>  >  The problem I have is with the & being systematically understood by
>  >  the right size of regexes to mean "the whole thing matched by the
>  >  matching left regex". While this is a common regex idiom in "basic"
>  >  regexes (sed acts this way for instance), it is not expected at all
>  >  from pcre (Perl doesn't know about &, and from what I've read about
>  >  pcre so far, pcre doesn't know about it either). Hence my puzzle.
>
>
> I think Apache is simulating perls $&, and I think it's on purpose.
>  Seems pretty unwise.

That is definitely the case.
-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Ampersand extends to the left part of regexes with RewriteRule, RedirectMatch and SetEnvIf: is that expected?

Posted by Eric Covener <co...@gmail.com>.
On 12/4/09, Francis GALIEGUE <fg...@one2team.com> wrote:

>  The problem I have is with the & being systematically understood by
>  the right size of regexes to mean "the whole thing matched by the
>  matching left regex". While this is a common regex idiom in "basic"
>  regexes (sed acts this way for instance), it is not expected at all
>  from pcre (Perl doesn't know about &, and from what I've read about
>  pcre so far, pcre doesn't know about it either). Hence my puzzle.

I think Apache is simulating perls $&, and I think it's on purpose.
Seems pretty unwise.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org