Welcome! Log In Create A New Profile

Advanced

Re: ngx_lua location capture issue

agentzh
October 19, 2011 08:44PM
On Thu, Oct 20, 2011 at 2:10 AM, Nginx User <nginx@nginxuser.net> wrote:
>> I think I've already fixed this issue in the ngx_lua v0.3.1rc17 release:
>>
>>    https://github.com/chaoslawful/lua-nginx-module/tags
>>
>> There was a bug in ngx.exec()'s handling when being used within
>> rewrite_by_lua* and access_by_lua* directives, which could cause
>> hanging in certain extreme conditions.
>>
>> Could you please try it out on your side?
>
> I'll have a go in due course. I have dumped the config originally
> posted. Will look into reconfiguring along those lines later.
>

Cool :)

> In the meantime, can you help out with my fallback?
>
> I have a set of about 70 regexes that are run using access_by_lua_file
> after finding out that access_by_lua has a string length limit
> (undefined).
>

It is the nginx config file parser has a length limit on individual
config directives. Use access_by_lua_file instead to put your Lua code
into an external .lua file and thus eliminating the length constraint
altogether.

> I have applied the escaping sequences and they generally work  but
> these ones generate errors:
>
> -- 42
>       -- original
> "(?:"\s*or\s*"?\d)|(?:\\x(?:23|27|3d))|(?:^.?"$)|(?:(?:^["\\]*(?:[\d"]+|[^"]+"))+\s*(?:n?and|x?or|not|\|\||\&\&)\s*[\w"[+&!@(),.-])|(?:[^\w\s]\w+\s*[|-]\s*"\s*\w)|(?:@\w+\s+(and|or)\s*["\d]+)|(?:@[\w-]+\s(and|or)\s*[^\w\s])|(?:[^\w\s:]\s*\d\W+[^\w\s]\s*".)|(?:\Winformation_schema|table_name\W)"
>       local query_string =
> ngx.re.match(ngx.var.request_uri,"(?:"\\\s*or\\\s*"?\\\d)|(?:\\\\\\x(?:23|27|3d))|

A rule of thumb is that "\" should become "\\\\" (four back-slashes!)
while using access_by_lua and "\\" (two back-slashes!) while using
access_by_lua_file. You're writing things like "\\\s" (three
back-slashes!), which is weird.

Why not put your Lua code into an external .lua file and use
access_by_lua_file or rewrite_by_lua_file instead? That way you only
need to escape each "\" only once.

Regards,
-agentzh

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

ngx_lua location capture issue

Nginx User October 18, 2011 12:56PM

Re: ngx_lua location capture issue

Nginx User October 18, 2011 01:30PM

Re: ngx_lua location capture issue

Nginx User October 18, 2011 01:30PM

Re: ngx_lua location capture issue

Nginx User October 18, 2011 02:00PM

Re: ngx_lua location capture issue

agentzh October 18, 2011 10:42PM

Re: ngx_lua location capture issue

agentzh October 18, 2011 10:50PM

Re: ngx_lua location capture issue

Nginx User October 19, 2011 12:46PM

Re: ngx_lua location capture issue

agentzh October 18, 2011 10:34PM

Re: ngx_lua location capture issue

agentzh October 19, 2011 05:26AM

Re: ngx_lua location capture issue

Nginx User October 19, 2011 02:12PM

Re: ngx_lua location capture issue

agentzh October 19, 2011 08:44PM

Re: ngx_lua location capture issue

Nginx User October 20, 2011 04:28AM

Re: ngx_lua location capture issue

agentzh October 20, 2011 04:48AM

Re: ngx_lua location capture issue

Nginx User October 20, 2011 06:50AM

Re: ngx_lua location capture issue

agentzh October 20, 2011 07:50AM

Re: ngx_lua location capture issue

Nginx User October 20, 2011 12:04PM

Re: ngx_lua location capture issue

agentzh October 21, 2011 12:10AM

Re: ngx_lua location capture issue

agentzh October 21, 2011 12:14AM

Re: ngx_lua location capture issue

Nginx User October 21, 2011 03:36AM

Re: ngx_lua location capture issue

Nginx User October 21, 2011 03:56AM

Re: ngx_lua location capture issue

Nginx User October 21, 2011 10:02AM

Re: ngx_lua location capture issue

Nginx User October 21, 2011 10:28AM

Re: ngx_lua location capture issue

Nginx User October 21, 2011 10:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 176
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready