打开了 2 个 TCP 连接: 1.正常连接(同时实现echo server,client)& 2.HTTP连接
在将 apache 作为服务器运行时使用 curl(已修改)实用程序打开 HTTP 连接,其中 curl 在连接建立后的一段时间内未发送 GET 请求。 对于连接建立后的正常连接,服务器正在等待来自客户端的请求。 但正如所观察到的,奇怪的是,在连接建立后的 HTTP 连接中,如果 GET 请求不是来自客户端(一段时间),服务器正在向客户端发送 FIN pkt 并关闭他的连接部分。 HTTP 客户端是否在初始连接后立即发送 GET 请求的强制条件。
最佳答案
Apache 有一个名为 Timeout 的参数。
它的手册页 ( Apache Core - Timeout Directive ) 指出:
The TimeOut directive defines the length of time Apache will wait for I/O in various circumstances:
- When reading data from the client, the length of time to wait for a TCP packet to arrive if the read buffer is empty.
- When writing data to the client, the length of time to wait for an acknowledgement of a packet if the send buffer is full.
- In mod_cgi, the length of time to wait for output from a CGI script.
- In mod_ext_filter, the length of time to wait for output from a filtering process.
- In mod_proxy, the default timeout value if ProxyTimeout is not configured.
我想你陷入了一号
编辑
我潜伏在 W3 HTTP 文档中,但没有发现超时。
但是进入第 8 章(连接)我发现:
8.1.4 Practical Considerations
服务器通常有一些超时值,超过该值它们将不再保持非事件连接。 (...) 持久连接的使用对客户端或服务器的超时长度(或存在)没有任何要求。
这听起来像是“每个服务器或客户端都可以自由选择关于非事件连接超时的行为”
关于apache - 一段时间后使用 HTTP 连接的 FIN pkt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14472868/