HTTP - Connection and Connection header
About
When an HTTP client initiates a request, it establishes a Transmission Control Protocol (TCP) connection to a particular port (80 by default) on a host.
An HTTP server listening on that port waits for the client to send a request message. Upon receiving the request, the server sends back a response.
Connection Header
Keep-Alive
The keep-alive value is the original HTTP/1.0 form to show that a persistent connection is desired (Ref
Connection: Keep-Alive
HTTP client library will not close connections after receiving the response when the goal is to implement HTTP persistent connections (aka “keep alive”).
It allows better performance.
The keep alive behavior is the default behavior in HTTP 1.1
Close
An HTTP/1.1 client by default expect a connection to remain open except when the server sends back in the response a Connection header with the connection-token close that indicates that the connection was closed by the server. ie
Connection: close
A client can also close of the TCP connection with this header value.
Transport Layer
HTTP is not constrained to using TCP/IP and its supporting layers, although this is its most popular application on the Internet. Indeed HTTP can be “implemented on top of any other protocol on the Internet, or on other networks.” HTTP only presumes a reliable transport; any protocol that provides such guarantees can be used.“