确实如此啊,后面多了一个$啊
[root@centos2 conf]# cat test.lua
ngx.say("hello world")
[root@centos2 conf]# cat test1.lua
local res = ngx.location.capture("/test")
ngx.say(res.body)
[root@centos2 conf]#
location /test{
content_by_lua_file 'conf/test.lua';
}
location /test1{
content_by_lua_file 'conf/test1.lua';
}
[root@HZ5 conf]# curl -i "http://xxx/test"|cat -vET
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 12 0 12 0 0 923 0 --:--:-- --:--:-- --:--:-- 2000
HTTP/1.1 200 OK^M$
Server: nginx/1.2.3^M$
Date: Fri, 07 Dec 2012 09:41:49 GMT^M$
Content-Type: application/octet-stream^M$
Transfer-Encoding: chunked^M$
Connection: keep-alive^M$
^M$
hello world$
[root@HZ5 conf]# curl -i "http://xxx/test1"|cat -vET
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 13 0 13 0 0 924 0 --:--:-- --:--:-- --:--:-- 2166
HTTP/1.1 200 OK^M$
Server: nginx/1.2.3^M$
Date: Fri, 07 Dec 2012 09:41:53 GMT^M$
Content-Type: application/octet-stream^M$
Transfer-Encoding: chunked^M$
Connection: keep-alive^M$
^M$
hello world$
$
[root@HZ5 conf]#
在 2012年12月7日星期五UTC+8下午5时31分52秒,kindy写道:
capture 默认没有这个行为的,你手工测试下 被 capture 的url 试试?
2012/12/7 zhan hu
<stone...@gmail.com>
碰到一个问题,最近有个业务吧原来多个请求输出合并,发现通过 ngx.location.capture 返回的res.body会在后面多加一个“\n” ;请问这个是什么bug?
--
- - - - - - - - - - - -
林青(Kindy Lin)