HTTP/1.0 Persistent Connections: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * HTTP Persistent Connections =Overview= It is the client that initially requests the connection to be kept alive. The persistent connection is initiated by...")
 
 
(3 intermediate revisions by the same user not shown)
Line 4: Line 4:


=Overview=
=Overview=
HTTP/1.0 clients can request a persistent connection by using "Connection: Keep-Alive" header. Early versions of the HTTP/1.1 specification also describe this mechanism.


It is the client that initially requests the connection to be kept alive. The persistent connection is initiated by specifying a "Keep-Alive" value for the "Connection" request header:
It is the client that initially requests the connection to be kept alive. The persistent connection is initiated by specifying a "Keep-Alive" value for the "Connection" request header:
Line 13: Line 15:
</pre>
</pre>


The server may or may not support persistent connections. If the server does support them, it will confirm that by including with the response a "Connection" response header:
The server may or may not support persistent connections. If the server does support them, it will confirm that by including with the response a "Connection: Keep-Alive" response header. httpd also includes a "Keep-Alive" header specifying the persistent connection attributes: the number of seconds it will be kept alive while idle and the maximum number of requests that will be allowed on a persistent connection.


<pre>
<pre>
Line 19: Line 21:
Content-Length: ...
Content-Length: ...
Connection: Keep-Alive
Connection: Keep-Alive
Keep-Alive: timeout=3600, max=100
</pre>
</pre>


Once both the client and the server have agreed on using persistent connections, they will keep the underlying TCP/IP connection open, and subsequent requests from that client will be sent over the persistent connection.
Once both the client and the server have agreed on using persistent connections, they will keep the underlying TCP/IP connection open, and subsequent requests from that client will be sent over the persistent connection.

Latest revision as of 23:30, 8 January 2017

Internal

Overview

HTTP/1.0 clients can request a persistent connection by using "Connection: Keep-Alive" header. Early versions of the HTTP/1.1 specification also describe this mechanism.

It is the client that initially requests the connection to be kept alive. The persistent connection is initiated by specifying a "Keep-Alive" value for the "Connection" request header:

GET ... HTTP/1.0
Host: ...
Connection: Keep-Alive

The server may or may not support persistent connections. If the server does support them, it will confirm that by including with the response a "Connection: Keep-Alive" response header. httpd also includes a "Keep-Alive" header specifying the persistent connection attributes: the number of seconds it will be kept alive while idle and the maximum number of requests that will be allowed on a persistent connection.

200 OK
Content-Length: ...
Connection: Keep-Alive
Keep-Alive: timeout=3600, max=100

Once both the client and the server have agreed on using persistent connections, they will keep the underlying TCP/IP connection open, and subsequent requests from that client will be sent over the persistent connection.