Word boundaries in regexps (Apache bug?)

Word boundaries in regexps (Apache bug?)

am 15.09.2009 12:41:23 von Victor Porton

Apache 2.2.13
http://localhost/test.shtml?city
Test 1 passed. Test 2 failed.

test.shtml follows

<<<<


Test 1 passed.

Test 1 failed.


Test 2 passed.

Test 2 failed.


>>>>

So test 2 is failed.
Why \b for word boundaries doesn't work?
Is it a bug of Apache? How I specify word boundaries in regexps?

--
Victor Porton - http://portonvictor.org


------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: Word boundaries in regexps (Apache bug?)

am 15.09.2009 12:52:44 von aw

Victor Porton wrote:
....
>
>

I am not sure which add-on module of Apache, and which version you are
talking about, but are you sure that the above right-hand side is
interpreted as a regexp, as opposed to a simple string ?
Can you point us to the relevant documentation ?



------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: Word boundaries in regexps (Apache bug?)

am 15.09.2009 13:11:34 von Tom Evans

On Tue, 2009-09-15 at 12:52 +0200, André Warnier wrote:
> Victor Porton wrote:
> ...
> >
> >
>
> I am not sure which add-on module of Apache, and which version you are
> talking about, but are you sure that the above right-hand side is
> interpreted as a regexp, as opposed to a simple string ?
> Can you point us to the relevant documentation ?
>
>
>

http://httpd.apache.org/docs/2.2/mod/mod_include.html#flowct rl

string1 = string2
string1 == string2
string1 != string2

Compare string1 with string2. If string2 has the form /string2/
then it is treated as a regular expression. Regular expressions
are implemented by the PCRE engine and have the same syntax as
those in perl 5. Note that == is just an alias for = and behaves
exactly the same way.

No idea why it isn't working for him.

Cheers

Tom


------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: Word boundaries in regexps (Apache bug?)

am 15.09.2009 13:29:33 von aw

Tom Evans wrote:
> On Tue, 2009-09-15 at 12:52 +0200, André Warnier wrote:
>> Victor Porton wrote:
>> ...
>>>
>> I am not sure which add-on module of Apache, and which version you are
>> talking about, but are you sure that the above right-hand side is
>> interpreted as a regexp, as opposed to a simple string ?
>> Can you point us to the relevant documentation ?
>>
>>
>>
>
> http://httpd.apache.org/docs/2.2/mod/mod_include.html#flowct rl
>
> string1 = string2
> string1 == string2
> string1 != string2
>
> Compare string1 with string2. If string2 has the form /string2/
> then it is treated as a regular expression. Regular expressions
> are implemented by the PCRE engine and have the same syntax as
> those in perl 5. Note that == is just an alias for = and behaves
> exactly the same way.
>
> No idea why it isn't working for him.
>
Allright then. And neither have I.
Victor, what about this for test #2 :



------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: Word boundaries in regexps (Apache bug?)

am 15.09.2009 14:18:25 von Victor Porton

On Tue, 2009-09-15 at 13:29 +0200, André Warnier wrote:
> Tom Evans wrote:
> > On Tue, 2009-09-15 at 12:52 +0200, André Warnier wrote:
> >> Victor Porton wrote:
> >> ...
> >>>
> >> I am not sure which add-on module of Apache, and which version you are
> >> talking about, but are you sure that the above right-hand side is
> >> interpreted as a regexp, as opposed to a simple string ?
> >> Can you point us to the relevant documentation ?
> >>
> >>
> >>
> >
> > http://httpd.apache.org/docs/2.2/mod/mod_include.html#flowct rl
> >
> > string1 = string2
> > string1 == string2
> > string1 != string2
> >
> > Compare string1 with string2. If string2 has the form /string2/
> > then it is treated as a regular expression. Regular expressions
> > are implemented by the PCRE engine and have the same syntax as
> > those in perl 5. Note that == is just an alias for = and behaves
> > exactly the same way.
> >
> > No idea why it isn't working for him.
> >
> Allright then. And neither have I.
> Victor, what about this for test #2 :
>

After this change the test 2 passes, but it does not pass if I enter
http://localhost/test2.shtml?city=2
(I need it to pass in this case also.)

BTW, I am about Apache 2.2.13 Linux.

--
Victor Porton - http://portonvictor.org


------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: Word boundaries in regexps (Apache bug?)

am 15.09.2009 15:05:54 von torsten.foertsch

Привет,

On Tue 15 Sep 2009, Victor Porton wrote:
> >
>
> After this change the test 2 passes, but it does not pass if I enter
> http://localhost/test2.shtml?city=3D2

Perhaps you have to outwit the SSI string parser. Just a guess:



Torsten

=2D-=20
Need professional mod_perl support?
Just hire me: torsten.foertsch@gmx.net

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: Word boundaries in regexps (Apache bug?)

am 15.09.2009 15:16:27 von aw

Torsten Foertsch wrote:
> Привет,
>
> On Tue 15 Sep 2009, Victor Porton wrote:
>>>
>> After this change the test 2 passes, but it does not pass if I enter
>> http://localhost/test2.shtml?city=2
>
> Perhaps you have to outwit the SSI string parser. Just a guess:
>
>
>
Yep, my bet would be on that one too right now.

If not, (but admittedly we can keep going on like this) :



------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: Word boundaries in regexps (Apache bug?)

am 15.09.2009 16:49:32 von Victor Porton

On Tue, 2009-09-15 at 15:05 +0200, Torsten Foertsch wrote:
> On Tue 15 Sep 2009, Victor Porton wrote:
> > >
> >
> > After this change the test 2 passes, but it does not pass if I enter
> > http://localhost/test2.shtml?city=2
>
> Perhaps you have to outwit the SSI string parser. Just a guess:
>
>

/\\bcity\\b/ works on my localhost (Debian Linux with Apache 2.2.13-1),
but does not work on http://logostudio.co.il/test.html?city with Apache
1.3.41 (FreeBSD).

--
Victor Porton - http://portonvictor.org


------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: Word boundaries in regexps (Apache bug?)

am 15.09.2009 17:40:49 von Nick Kew

Victor Porton wrote:
> On Tue, 2009-09-15 at 15:05 +0200, Torsten Foertsch wrote:
>> On Tue 15 Sep 2009, Victor Porton wrote:
>>>>
>>> After this change the test 2 passes, but it does not pass if I enter
>>> http://localhost/test2.shtml?city=2
>> Perhaps you have to outwit the SSI string parser. Just a guess:
>>
>>
>
> /\\bcity\\b/ works on my localhost (Debian Linux with Apache 2.2.13-1),

Good. Mystery solved (though I have to confess I'm a little
surprised you need that in the context).

> but does not work on http://logostudio.co.il/test.html?city with Apache
> 1.3.41 (FreeBSD).

As I told you earlier on IRC, 1.3 used a pre-PCRE regexp engine.

--
Nick Kew

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: Word boundaries in regexps (Apache bug?)

am 15.09.2009 18:28:31 von torsten.foertsch

On Tue 15 Sep 2009, Nick Kew wrote:
> > /\\bcity\\b/ works on my localhost (Debian Linux with Apache
> > 2.2.13-1),
>
> Good. =A0Mystery solved (though I have to confess I'm a little
> surprised you need that in the context).

Here is the piece of code that (I believe) eats the backslashes (mod_includ=
e.c:
get_ptoken()). token->value is the start of the string, p the end. shift is
the number of unescaped backslashes found in the string.

apr_size_t len =3D p - token->value - shift;
char *c =3D apr_palloc(ctx->dpool, len + 1);

p =3D token->value;
token->value =3D c;

while (shift--) {
const char *e =3D ap_strchr_c(p, '\\'); /* move e to the next =
backslash */

memcpy(c, p, e-p); /* copy up to the backsl=
ash excluding it */
c +=3D e-p; /* now c points to the=
end of the destination string */
*c++ =3D *++e; /* copy there the char=
that comes *after* the '\' and forget about the '\' */
len -=3D e-p;
p =3D e+1;
}

if (len) {
memcpy(c, p, len);
}
c[len] =3D '\0';

Torsten

=2D-=20
Need professional mod_perl support?
Just hire me: torsten.foertsch@gmx.net

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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