Issue in Lua-nginx-module when use both ngx.location.capture and ngx.exec

Wendal Chen wendal1985 at gmail.com
Tue Mar 15 14:45:26 MSK 2011


nginx.conf

location /test {
    root html;
    content_by_lua_file "conf/test.lua";
}

test.lua:
-- start
ngx.location.capture('/1.html')

ngx.exec("/1.html")
-- end

Files in folder :

nginx
    -- conf
        -- nginx.conf
        -- test.lua
    -- html
        -- 1.html

That is all

#用中文再说一遍,英语水平有限:
我得到的最小集合就是:
1. nginx.conf
location /test {
    root html;
    content_by_lua_file "conf/test.lua";
}
server/http等配置按默认的, event module用的是 epoll

2. test.lua文件仅2行:
ngx.location.capture('/1.html')

ngx.exec("/1.html")

我尝试过,无论这两句话是否请求同一个文件,结果都一样.

3. 1.html文件里面仅有几个字母,我已经试过不同的文件大小,结果一样


我遇到的情况是这样的:
1. 通过wget/curl/Firefox来访问 localhost/test 都能正常显示1.html中的内容
2. 使用ab访问 localhost/1.html是正常的,能够pass
3. 使用ab进行测试,总是timeout , 我使用的语句是 ab -v 5 localhost/test
Benchmarking localhost (be patient)...INFO: POST header ==
---
GET /down2 HTTP/1.0
Host: localhost
User-Agent: ApacheBench/2.3
Accept: */*


---
LOG: header received:
HTTP/1.1 200 OK
Server: nginx/0.8.54
Date: Tue, 15 Mar 2011 07:22:30 GMT
Content-Type: text/plain
Content-Length: 4
Last-Modified: Fri, 11 Mar 2011 09:32:28 GMT
Connection: close
Accept-Ranges: bytes

ABC

LOG: Response code = 200
apr_poll: The timeout specified has expired (70007)

其中的ABC就是1.html的内容, 非常抱歉我之前写错了.

对于0A0D的描述,仅仅是我的猜测,请无视之.

单独写 ngx.exec("/1.html") 也是能够通过ab测试的.

环境:
Ubuntu 10.10
Luajit-5.1-dev
Nginx 0.8.54
Lua-nginx-module 0.16rc2

Thanks,
Wendal Chen

2011/3/15 agentzh <agentzh at gmail.com>

> On Tue, Mar 15, 2011 at 3:26 PM, Wendal Chen <wendal1985 at gmail.com> wrote:
> > Hi,
> >
> > Lua-nginx-module 0.16RC2
> > Nginx  0.8.54
> >
> [snip]
> >
> > I am Best
> >
> > LOG: Response code = 200
> > apr_poll: The timeout specified has expired (70007)
> >
>
> Can you provide a minimized but complete example to help us reproduce
> this issue?
>
> I do not understand where the output "I am Best" came from in your
> sample, for example.
>
> And in particular, what exactly were you doing in "-- do something for res"
> ?
>
> > I think lua-nginx-module lose some 0x0A 0x0D in resp.
> >
>
> Where does "0x0A 0x0D" come from?
>
> Cheers,
> -agentzh
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20110315/ed4651d3/attachment.html>


More information about the nginx mailing list