?
This document uses PHP Chinese website manual Release
非標準
這個功能是非標準的,不在標準軌道上。不要在面向 Web 的生產站點上使用它:它不適用于每個用戶。實現之間也可能存在很大的不兼容性,并且行為在未來可能會發(fā)生變化。
Keep-Alive
一般報頭允許發(fā)送者提示關于如何連接,并且可以被用于設置超時時間,并且請求的最大數量。
Connection
頭需要被設置為“?;睢边@個標題有任何意義。此外,Connection
和Keep-Alive
在 HTTP / 2 忽略; 連接管理由其他機制處理。
Header type | General header |
---|---|
Forbidden header name | no |
Keep-Alive: parameters
_parameters_ 逗號分隔的參數列表,每個參數都包含由等號('='
)分隔的標識符和值。以下標識符是可能的:
timeout
:指示空閑連接必須保持打開的最短時間(以秒為單位)。請注意,如果在傳輸級別上未設置保持活動 TCP 消息,則可能會忽略超過 TCP 超時的超時。
max
:指示在關閉它之前可以在此連接上發(fā)送的最大請求數。除非0
,對于非流水線連接,此值將被忽略,因為另一個請求將在下一個響應中發(fā)送。HTTP 管道可以使用它來限制流水線。
包含Keep-Alive
標題的響應:
HTTP/1.1 200 OK Connection: Keep-Alive Content-Encoding: gzip Content-Type: text/html; charset=utf-8Date: Thu, 11 Aug 2016 15:23:13 GMT Keep-Alive: timeout=5, max=1000Last-Modified: Mon, 25 Jul 2016 04:32:39 GMT Server: Apache(body)
Specification | Title |
---|---|
HyperText Transport Protocol Keep-Alive Header | The Keep-Alive Header (Experimental specification) |
RFC 7230, section appendix-A.1.2: Keep-Alive | Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing |
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic Support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
Feature | Android | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
Basic Support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
Connection
HTTP / 1.x 中的連接管理