Kow*_*hik 2 ruby webserver timeout http thin
Thin的代码/文档表明默认连接超时为30秒.但是,当我尝试测试时,它似乎不起作用.我错过了什么?
我正在使用瘦v1.5.0(最新版本).
# Test this using: curl -X GET http://localhost:3000/test. You will find that the request does not
# timeout after 30s.
require 'thin'
class SimpleAdapter
def call(env)
sleep 100
body = ["hello!"]
[
200,
{ 'Content-Type' => 'text/plain' },
body
]
end
end
server = Thin::Server.new('127.0.0.1', 3000) do
map '/test' do
run SimpleAdapter.new
end
end
server.start!
Run Code Online (Sandbox Code Playgroud)
内联文档说明了以下内容:
在删除连接之前传入数据到达的最大秒数.
并且Thin正确显示该行为,即,如果您远程登录到服务器:
telnet localhost 3000
Run Code Online (Sandbox Code Playgroud)
并等待30秒,它会断开连接.但是,cURL命令已经向Thin服务器发送了一个完整的HTTP请求,这就是永远不会达到等待传入数据的超时的原因.
| 归档时间: |
|
| 查看次数: |
299 次 |
| 最近记录: |