Persistent connections (original) (raw)
Although the Keep-Alive: proposal was meant to be experimental, some vendors now have an installed base of software that implements this header.
continue to use it as currently understood.
However, HTTP/1.1 clients (and HTTP/1.1 proxies acting as clients) MUST NOT send Keep-Alive: to a proxy (of any version), because of the danger that an HTTP/1.0 proxy will forward it improperly.
Instead, HTTP/1.1 clients (and HTTP/1.1 proxies acting as clients) wishing for a persistent connection should send:
Persist:
Connection: Persist
in their request. The is the DNS name or IP (v4 or v6) address of the server/proxy that the client believes it is sending the request to. Since the server/proxy knows its own name(s), there is no DNS lookup required here, and it works for clients using SOCKS to get through a firewall. And since an IP address (in v4 or v6 notation) is usually legal wherever a DNS name would be, we must allow addresses here.
[Note: "Persist:" was called "Alex:" at the meeting and in the minutes, for reasons not worth elaborating upon.]
If a server/proxy receives a request with a Persist: header carrying the wrong name (not one of the names that it goes by), it MUST NOT create a persistent connection.
Otherwise, a server/proxy responds with
Persist:
Connection: Persist
if it agrees to create a persistent connection.
An HTTP/1.1 client or proxy may send
Keep-Alive:
Persist:
Connection: Keep-Alive, Persist
to an origin server (but NOT to a proxy). This allows it to request a persist connection from either an HTTP/1.1 or HTTP/1.0+keepalive server without knowing in advance what the server type is. If the server supports both mechanisms, it should respond with
Keep-Alive:
Persist:
Connection: Keep-Alive, Persist
This combined behavior should also help in the case where an origin server is hidden behind a SOCKS or network address translation system, and consequently has the "wrong" name. However, this is not a complete solution (e.g, a proxy hidden behind a NAT system will not accept Persist:).
A client that "learns" that a server supports Persist: could refrain from sending Keep-Alive: in the future, to avoid the extra overhead.
An HTTP/1.1 proxy that receives a Keep-alive: request from an HTTP/1.1 client or proxy MUST NOT create a persistent connection; this event indicates that something has gone wrong somewhere.