Hi Lukas,

Thanks for your bug report.
Sorry for not responding earlier. Actually I did not watch this
mailing list for some time.

I made a patch to fix this problem.
After applying this patch, it seems work correctly now.

/etc/haproxy/haproxy.cfg

```
frontend all 0.0.0.0:80
  default_backend nginx8000
  acl side2 hdr_reg(host) -i -f /etc/haproxy/ip_reg.txt
  use_backend     side2be if side2

backend nginx8000
  server server1 127.0.0.1:8000

backend side2be
  server server1 127.0.0.1:8001
```

/etc/haproxy/haproxy.cfg

```
\b(?:\d{1,3}\.){3}\d{1,3}\b
\.us
```

$ ./haproxy -vv
HA-Proxy version 1.5-dev18 2013/04/03
Copyright 2000-2013 Willy Tarreau <[email protected]>

Build options :
  TARGET  = linux2628
  CPU     = native
  CC      = gcc
  CFLAGS  = -O2 -march=native -g -fno-strict-aliasing
  OPTIONS = USE_ZLIB=1 USE_OPENSSL=1 USE_STATIC_PCRE=1 USE_PCRE_JIT=1

Default settings :
  maxconn = 2000, bufsize = 16384, maxrewrite = 8192, maxpollevents = 200

Encrypted password support via crypt(3): yes
Built with zlib version : 1.2.3
Compression algorithms supported : identity, deflate, gzip
Built with OpenSSL version : OpenSSL 1.0.0-fips 29 Mar 2010
OpenSSL library supports TLS extensions : yes
OpenSSL library supports SNI : yes
OpenSSL library supports prefer-server-ciphers : yes
Built with PCRE version : 8.32 2012-11-30
PCRE library supports JIT : yes

Available polling systems :
      epoll : pref=300,  test result OK
       poll : pref=200,  test result OK
     select : pref=150,  test result OK
Total: 3 (3 usable), will use epoll.

$ ./haproxy -d -f /etc/haproxy/haproxy.cfg

In another terminal
$ curl -H Host:a.us http://localhost
nginx at port 8001
$ curl -H Host:255.1.1.1 http://localhost
nginx at port 8001
$ curl -H Host:255.1.1.1.4 http://localhost
nginx at port 8001
$ curl -H Host:foo.com http://localhost
nginx at port 8000


Here is my build steps for CentOS 6.4 x86_64.
```
## pcre
cd /usr/local
curl -LO 
http://downloads.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.bz2
tar xf pcre-8.32.tar.bz2
cd pcre-8.32
./configure --prefix=/usr/local --libdir=/usr/local/lib64 \
      --enable-jit --enable-utf
make
make install
echo /usr/local/lib64 > /etc/ld.so.conf.d/pcre-8.32.x86_64.conf
ldconfig

## haproxy
yum install -y openssl-devel zlib-devel
cd /usr/local
curl -LO http://haproxy.1wt.eu/download/1.5/src/devel/haproxy-1.5-dev18.tar.gz
tar xf haproxy-1.5-dev18.tar.gz
cd haproxy-1.5-dev18
patch -p1 < /usr/local/0001-MINOR-show-PCRE-version-and-JIT-status-in-vv.patch
patch -p1 < /usr/local/0002-PCRE_JIT_fix.patch
make TARGET=linux2628 CPU=native USE_STATIC_PCRE=1 USE_PCRE_JIT=1
USE_OPENSSL=1 USE_ZLIB=1
make install
```

2013/4/5 Lukas Tribus <[email protected]>:
> Hi Igor,
>
>> error detected while parsing ACL 'side2' : regex
>> '\b(?:\d{1,3}\.){3}\d{1,3}\b' is invalid.
>>
>> The config works fine without JIT enable.
>
> Yes, I can reproduce this. In fact, it does not work _at all_ and
> fails even if the expression just contains a few letters, like
> literally "justafewletters":
>
> config:
>> acl side2 hdr_reg(host) justafewletters
>> use_backend     side2be if side2
>
> log:
> [ALERT] 093/204028 (11204) : parsing [../cert/haproxy.cfg:28] : error 
> detected while parsing ACL 'side2' : regex 'justafewletters' is invalid.
> [ALERT] 093/204028 (11204) : parsing [../cert/haproxy.cfg:36] : error 
> detected while parsing switching rule : no such ACL : 'side2'.
> [ALERT] 093/204028 (11204) : Error(s) found in configuration file : 
> ../cert/haproxy.cfg
> [ALERT] 093/204028 (11204) : Fatal errors found in configuration.
>
>
> You are using pcre 8.21, I'm using latest pcre 8.32, so its not
> the libpcre either.
>
> Without JIT, this works fine.
>
>
> Hiroaki, since you are the original author, could you take a look at
> this please?
>
>
>
> Regards,
> Lukas
>
>
> --------
>
>
> (for everyone interested and for my own reference:)
> To build haproxy with a recent libpcre, without touching the system:
> wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.32.tar.gz
> unp pcre-8.32.tar.gz; cd pcre-8.32;
> ./configure --enable-jit --enable-utf && make
>
> and then from HAProxy:
> make [...] USE_STATIC_PCRE=1 USE_PCRE_JIT=1 PCRE_INC=~/pcre-8.32/ \
> PCRE_LIB=~/pcre-8.32/.libs
>
> This way, haproxy is statically build with the most recent pcre,
> but without installing it to your system (which would probably
> break things).

-- 
)Hiroaki Nakamura)

Attachment: 0002-PCRE_JIT_fix.patch
Description: Binary data

Reply via email to