ngx_lua location capture issue

Nginx User nginx at nginxuser.net
Wed Oct 19 18:10:49 UTC 2011


On 19 October 2011 12:24, agentzh <agentzh at gmail.com> wrote:
> On Wed, Oct 19, 2011 at 10:33 AM, agentzh <agentzh at gmail.com> wrote:
>> On Wed, Oct 19, 2011 at 12:55 AM, Nginx User <nginx at nginxuser.net> wrote:
>>>        location /test_loc {
>>>                internal;
>>>                alias /usr/share/test_loc/;
>>>                rewrite_by_lua 'ngx.exec("@proxy");';
>>
>> Could you please try using content_by_lua here instead of
>> rewrite_by_lua? I want to confirm that it is indeed a bug in
>> rewrite_by_lua rather than content_by_lua :)
>>
>
> 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.

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).

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))|(?:^.?"$)|(?:(?:^["\\\\\\]*(?:[\\\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)",
"io")
-- 45
       -- original
"(?:union\s*(?:all|distinct|[(!@]*)?\s*[([]*\s*select)|(?:\w+\s+like\s+\")|(?:like\s*"\%)|(?:"\s*like\W*["\d])|(?:"\s*(?:n?and|x?or|not
|\|\||\&\&)\s+[\s\w]+=\s*\w+\s*having)|(?:"\s*\*\s*\w+\W+")|(?:"\s*[^?\w\s=.,;)(]+\s*[(@"]*\s*\w+\W+\w)|(?:select\s*[\[\]()\s\w\.,"-]+from)|(?:find_in_set\s*\()"
       local query_string = ngx.re.match(ngx.var.request_uri,
"(?:union\\\s*(?:all|distinct|[(!@]*)?\\\s*[([]*\\\s*select)|(?:\\\w+\\\s+like\\\s+\\\")|(?:like\\\s*"\\\%)|(?:"\\\s*like\\\W*["\\\d])|(?:"\\\s*(?:n?and|x?or|not
|\\\|\\\||\\\&\\\&)\\\s+[\\\s\\\w]+=\\\s*\\\w+\\\s*having)|(?:"\\\s*\\\*\\\s*\\\w+\\\W+")|(?:"\\\s*[^?\\\w\\\s=.,;)(]+\\\s*[(@"]*\\\s*\\\w+\\\W+\\\w)|(?:select\\\s*[\\\[\\\]()\\\s\\\w\\\.,"-]+from)|(?:find_in_set\\\s*\\\()",
"io")

Thanks



More information about the nginx mailing list