谢谢您的指导。
Best Wishes,
Wenhua
2013/1/26 agentzh <age...@gmail.com>:
> Hello!
>
> On Fri, Jan 25, 2013 at 1:36 AM, Wenhua Zhang wrote:
>> 从git log中找到如下信息,PCRE_DUPNAMES和PCRE_JAVASCRIPT_COMPAT是在这次改动中引入的:
>>
>> commit fec300b7360d3da7f1244d22d73fcbc5791775e0
>> Author: agentzh (Yichun Zhang) <age...@gmail.com>
>> Date: Wed Jan 16 11:59:57 2013 -0800
>>
>> bugfix: we did not get the request reference counter right when
>> lua_need_request_body was turned on and nginx versions older than
>> 1.2.6 or 1.2.9 were used.
>>
>
> 你把 commit 搞错了。这个 commit 是完全不相干的 :)
>
> 其实 PCRE_JAVASCRIPT_COMPAT 是下面这次 commit 引入的更动:
>
> commit 07d48739683039b708efbed5b52924a801d9616b
> Author: agentzh (Yichun Zhang) <age...@gmail.com>
> Date: Thu Jan 24 11:48:51 2013 -0800
>
> feature: implemented the "J" regex option for the PCRE Javascript
> compatible mode in the ngx.re API. thanks lhmwzy for requesting this.
>
> 而 PCRE_DUPNAMES 则是在下面这次 commit 中引入的:
>
> commit a6d8faf2bbfcda87e06b17da67e9f66777dd2c0e
> Author: agentzh (Yichun Zhang) <age...@gmail.com>
> Date: Wed Jan 23 18:25:36 2013 -0800
>
> feature: implemented named subpatterns for ngx.re.match,
> ngx.re.gmatch, ngx.re.sub, and ngx.re.gsub; also added new regex
> option "D" to allow duplicate named subpatterns. thanks Ray Bejjani
> for the patch in github pull #182.
>
>>> 在编译nginx的时候,chaoslawful-lua-nginx-module出现了如下错误:
>>>
>>> chaoslawful-lua-nginx-module-a1fe49f/src/ngx_http_lua_regex.c: In
>>> function 'ngx_http_lua_ngx_re_parse_opts':
>>> chaoslawful-lua-nginx-module-a1fe49f/src/ngx_http_lua_regex.c:1101:
>>> error: 'PCRE_DUPNAMES' undeclared (first use in this function)
>>> chaoslawful-lua-nginx-module-a1fe49f/src/ngx_http_lua_regex.c:1101:
>>> error: (Each undeclared identifier is reported only once
>>> chaoslawful-lua-nginx-module-a1fe49f/src/ngx_http_lua_regex.c:1101:
>>> error: for each function it appears in.)
>>> chaoslawful-lua-nginx-module-a1fe49f/src/ngx_http_lua_regex.c:1106:
>>> error: 'PCRE_JAVASCRIPT_COMPAT' undeclared (first use in this
>>> function)
>>> make[1]: *** [objs/addon/src/ngx_http_lua_regex.o] Error 1
>>>
>>> 请问这个和pcre的版本有关系吗?
>>>
>>> # rpm -qa | grep pcre
>>> pcre-6.6-2.el5_1.7
>>> pcre-6.6-6.el5_6.1
>>> pcre-devel-6.6-6.el5_6.1
>
> 多谢你的问题报告 :)
>
> 你使用的 PCRE 是如此古老,以至于还不支持 PCRE_DUPNAMES 和 PCRE_JAVASCRIPT_COMPAT 这样的 PCRE 特性。
>
> 我刚刚向 ngx_lua 的 master 分支提交了一个小补丁,修复了与 PCRE 6.6 这样古老版本的兼容性问题:
>
> https://github.com/chaoslawful/lua-nginx-module/commit/7422139
>
> 现在 ngx.re API 的正则选项 D 和 J 都需要至少 PCRE 8.12.
>
> 值得一提的是,建议总是自己从源码安装最新版本的 PCRE(目前是 8.32):
>
> ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
>
> 同时启用 PCRE JIT 支持可以获得正则匹配操作上显著的性能提升(同时 Nginx 或者 OpenResty 也使用
> ./configure --with-pcre-jit 来构造,调用 ngx_lua 的 ngx.re API 时也显式指定 jo
> 正则选项)。
>
> Best regards,
> -agentzh