The web
HTTP keep-alive
Several HTTP requests over one TCP connection instead of a new handshake for each.
HTTP keep-alive means sending several requests over one TCP connection instead of opening a new one for each.
HTTP/1.1 keeps the connection open by default, so the next request skips the TCP handshake and, over HTTPS, the TLS one.
The client finds where each response ends from its Content-Length or chunked encoding. Connection: close asks the
server to hang up after answering. The server closes idle connections after a timeout.
Read next
- HTTP The web's request and response protocol: plain text over TCP unless wrapped in TLS.
- Three-way handshake SYN, SYN-ACK, ACK: how TCP opens a connection, each side agreeing on starting sequence numbers.
- TCP Reliable, ordered byte streams between programs: handshake, acknowledgements, retransmission.
- HTTP/2 HTTP's meaning in binary frames: many requests as streams over one TCP connection, headers compressed.