Coder Social home page Coder Social logo

Comments (10)

wangbin579 avatar wangbin579 commented on May 22, 2024

pcre信息如下:

[root@bgp176-148 pcre-8.31]# ./pcretest -C
PCRE version 8.31 2012-07-06
Compiled with
8-bit support only
UTF-8 support
Unicode properties support
No just-in-time compiler support
Newline sequence is LF
\R matches all Unicode newlines
Internal link size = 2
POSIX malloc threshold = 10
Default match limit = 10000000
Default recursion depth limit = 10000000
Match recursion uses stack

from tengine.

wangbin579 avatar wangbin579 commented on May 22, 2024

直接把其中没法编译的正则抽取出来,利用pcregrep就没有问题

pcregrep '~^(?Pwww\p{N}+).example.com' test.log 没有报错

from tengine.

yaoweibin avatar yaoweibin commented on May 22, 2024

看起来是用自己编译的PCRE库? 编译选项是什么?

另外系统中没有默认的PCRE库?

你的Nginx编译选项是什么?

from tengine.

wangbin579 avatar wangbin579 commented on May 22, 2024

pcre编译选项:
./configure --enable-utf8 --enable-unicode-properties

系统中已经有默认的pcre库

nginx的编译选项
./configure --with-http_concat_module --with-http_slice_module --with-pcre=/home/wangbin/software/pcre-8.31

from tengine.

wangbin579 avatar wangbin579 commented on May 22, 2024

加了,貌似test还是只认老的版本
直接使用
./pcregrep '~^(?Pwww\p{N}+).example.com$' test.log
没有问题,但在test中就报错误。

不知道为啥test没有用最新版本的pcre

from tengine.

wangbin579 avatar wangbin579 commented on May 22, 2024

做了一个试验,
在http_server_name.t文件中如果把下面一行:

server_name "~^(?Pwww\p{N}+).example.com$";

改成

server_name "^(?Pwww\p{N}+).example.com$";

也就是去掉‘~’,测试就通过了。

之前报的错误可能有误导性,也有可能真是没有利用到最新版本的pcre。

还有我对perl不熟悉,为啥去掉‘~’就可以了,直接用

./pcregrep "~^(?Pwww\p{N}+).example.com$" test.log
也没有问题

还有,粘贴命令过来,好多被转义了,比如‘.'被转成了‘.',不要直接复制上面的命令去试验。

from tengine.

yaoweibin avatar yaoweibin commented on May 22, 2024

On 2012/9/28 18:13, bin wang wrote:

做了一个试验,
在http_server_name.t文件中如果把下面一行:

server_name "~^(?Pwww\p{N}+).example.com$";

改成

server_name "^(?Pwww\p{N}+).example.com$";

也就是去掉‘~’,测试就通过了。

之前报的错误可能有误导性。

还有我对perl不熟悉,为啥去掉‘~’就可以了

波浪形不是正则库的符号,这是Nginx命令的一部分,以波浪形打头说明是正则的
虚拟主机域名,后面的才是真正编译的正则表达式。

Thanks
-YWB

from tengine.

yaoweibin avatar yaoweibin commented on May 22, 2024

我发现Nginx的auto脚本会自己去编译pcre库,而且用自己的编译选项,看 这里:
https://github.com/taobao/tengine/blob/master/auto/lib/pcre/make#L54

./configure --disable-shared $PCRE_CONF_OPT

刚刚我尝试在Nginx的configure里面加入编译选项,没有成功。--with-pcre-opt
选项是改变CC的编译选项,不是PCRE库的configure选项。

我现在想到的办法就是你自己编译PCRE库,覆盖老的PCRE库。

或者

你直接改auto脚本,在上述的configure脚本里面加入“--enable-utf8 --enable-
unicode-properties”选项。

原生的Nginx也有这个问题。

On 2012/9/28 17:18, bin wang wrote:

pcre编译选项:
./configure --enable-utf8 --enable-unicode-properties

系统中已经有默认的pcre库

nginx的编译选项
./configure --with-http_concat_module --with-http_slice_module
--with-pcre=/home/wangbin/software/pcre-8.31


Reply to this email directly or view it on GitHub
https://github.com/taobao/tengine/issues/80#issuecomment-8968787.

Thanks
-YWB

from tengine.

wangbin579 avatar wangbin579 commented on May 22, 2024

果然如你所料,现在ok了

from tengine.

hwyuan avatar hwyuan commented on May 22, 2024

不好意思,最近开始接触nginx,刚刚也遇到了这个问题。所以请问最终的解决方法是什么呢?我们需要手动更改/auto/lib/pcre/make文件么。谢谢。 @wangbin579

from tengine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.