Feature Request: Tracking # of HTTP requests made on the current TCP connection
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- ruby
- 领域
- api, networking
调研方向
从 lib/net/http.rb 中引用的 connect 和 begin_transport 位置开始,跟踪持久连接是如何建立和重用的。确认创建 TCP 连接时请求计数会重置,并在传输尝试之后递增,以便调用方能够准确观察当前连接上发出的请求。
由索引模型根据 Issue 内容生成。
描述
For persistent connections, some servers are configured to reset them after a certain number of HTTP requests. Net::HTTP::Persistent added a max_requests variable to preemptively close your connection after a certain amount of HTTP requests are made for this reason in https://github.com/drbrain/net-http-persistent/pull/42
However, without changes to Net::HTTP, Net::HTTP::Persistent can only track how many times it makes a request of it's Net::HTTP instance. But this isn't perfect: begin_transport can re-connect on a new TCP connection if it finds the socket was closed some time after the last time you used it, like if the server closed the connection, and Net::HTTP::Persistent will never know there's a new TCP connection, and that it should therefor reset its count of requests over the TCP connection back to 0.
My suggestion is that we make an instance variable here in Net::HTTP called @num_requests_on_connection, that gets set to 0 at the end of connect, and is incremented at the end of begin_transport after the reconnection attempts. I believe that way we could get an accurate count!
@raggi @drbrain
- 主要语言
- Ruby
- 星标
- 148
- 派生
- 95
- 平均合并
- 10 小时 54 分钟
- 30 天内合并 PR
- 4
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ruby/net-http 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 83/100
-
难度 5/5 一周以上 新手友好度 38/100
-
难度 4/5 3-5 天 新手友好度 55/100
-
难度 4/5 3-5 天 新手友好度 55/100
相似的 Issue
-
user-reported
难度 2/5 1-3 小时 新手友好度 85/100
Kong/developer.konghq.com#7316 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
TheOdinProject/curriculum#31408 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 74/100
bensheldon/good_job#1816 · 5 条评论 ·
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
notch8/utk_knapsack#148 ·