HTTP保持活动超时 [英] HTTP keep-alive timeout

查看:244
本文介绍了HTTP保持活动超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以指定 HTTP超时还是服务器强加一个值?
例如,如果我这样做:

Can I specify the HTTP timeout or does the server impose a value? For example, if I do:

telnet my.server.net 80
Trying X.X.X.X...
Connected to my.server.net.
Escape character is '^]'.
GET /homepage.html HTTP/1.0
Connection: keep-alive
Host: my.server.net

HTTP/1.1 200 OK
Date: Thu, 03 Oct 2013 09:05:28 GMT
Server: Apache
Last-Modified: Wed, 15 Sep 2010 14:45:31 GMT
ETag: "1af210b-7b-4904d6196d8c0"
Accept-Ranges: bytes
Content-Length: 123
Vary: Accept-Encoding
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html
[...]

行:

The line:

Keep-Alive: timeout=15, max=100

...指定有100秒的最大超时,对吗?如何设置此值?

...specifies that there is a maximum timeout of 100 seconds, right? How can I set such value?

推荐答案

客户端无法指定超时值,它是确定最大超时值的服务器配置。额外的Keep-Alive头可以通知客户端服务器多长时间保持连接打开(timeout = N值)以及在服务器强制关闭之前可以通过同一连接执行多少次请求(max = M) 。

The client cannot specify the timeout, it is the server configuration that determines the maximum timeout value. The extra Keep-Alive header can inform the client how long the server is willing to keep the connection open (timeout=N value) and how many requests you can do over the same connection (max=M) before the server will force a close of the connection.

另请参阅在Apache Htaccess中正确使用KeepAlive

这篇关于HTTP保持活动超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆