Groups
Groups
Sign in
Groups
Groups
openresty
Conversations
Labels
About
Send feedback
Help
如何早点结束慢链接
162 views
cosocket
lua
openresty
Skip to first unread message
魏海通
unread,
Jul 24, 2018, 5:09:13 AM
7/24/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openresty
在body_filter 阶段判断速度,如果低于配置的阈值就结束链接:
return
ngx.
ERROR
但是用这种方法断开时,还会继续发送队列里面的数据,请问如何才能丢掉发送缓存区的数据,尽早结束链接?
Hadals Yang
unread,
Jul 24, 2018, 9:16:00 PM
7/24/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openresty
返回444 行不行?
tokers
unread,
Jul 24, 2018, 9:52:09 PM
7/24/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openresty
Hello!
可以了解下 ngx.arg 的用法,
https://github.com/openresty/lua-nginx-module#toc105
。
在 body_filter 阶段只要你把 ngx.arg[2] 设置成 true,就能结束往下游发送数据了。
魏海通
unread,
Jul 25, 2018, 5:52:41 AM
7/25/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openresty
谢谢,444试了,还是会调用close,这样TCP缓冲区还是会有数据发送出去吧。是有直接RST的做法?
在 2018年7月25日星期三 UTC+8上午9:16:00,Hadals Yang写道:
返回444 行不行?
魏海通
unread,
Jul 25, 2018, 5:54:30 AM
7/25/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openresty
这种情况TCP层应该是CLOSE,在 ngx.arg[2] 设置成 true 前的数据,没有发送的还是继续发送。
在 2018年7月25日星期三 UTC+8上午9:52:09,tokers写道:
Zexuan Luo
unread,
Jul 25, 2018, 6:14:51 AM
7/25/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to open...@googlegroups.com
想跳过挥手阶段直接发送 RST,是没有现成的 API 可以用的。
也许你可以写一个 Nginx C 模块,设置给定 socket fd 的 SO_LINGER ,参考
https://github.com/nginx/nginx/blob/master/src/http/ngx_http_request.c#ngx_http_free_request
里面的做法。
> --
> --
> 邮件来自列表“openresty”,专用于技术讨论!
> 订阅: 请发空白邮件到
openresty...@googlegroups.com
> 发言: 请发邮件到
open...@googlegroups.com
> 退订: 请发邮件至
openresty+...@googlegroups.com
> 归档:
http://groups.google.com/group/openresty
> 官网:
http://openresty.org/
> 仓库:
https://github.com/agentzh/ngx_openresty
> 教程:
http://openresty.org/download/agentzh-nginx-tutorials-zhcn.html
魏海通
unread,
Jul 25, 2018, 11:32:14 PM
7/25/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openresty
多谢,我参考一下
在 2018年7月25日星期三 UTC+8下午6:14:51,Zexuan Luo写道:
Jianqiang Wang
unread,
Jul 27, 2018, 10:14:04 AM
7/27/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openresty
了解下
http://nginx.org/en/docs/http/ngx_http_core_module.html#reset_timedout_connection
魏海通
unread,
Jul 31, 2018, 7:10:40 AM
7/31/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openresty
多谢,这个参数是全局的,如果客户是HTTP1.0 或者 服务器端主动关闭,在一定程度是丢掉了应该传输的数据。
我们的想法是做成请求级别的。
在 2018年7月27日星期五 UTC+8下午10:14:04,Jianqiang Wang写道:
Jianqiang Wang
unread,
Aug 1, 2018, 8:44:49 AM
8/1/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openresty
https://github.com/nginx/nginx/commit/527cac297952f802b834704a74436a4fa55c3957#diff-d57c27b3aa34ba85676b639a618161c7
了解下~
Reply all
Reply to author
Forward
0 new messages