HTTP functions as a request-response protocol in the client-server computing model. In HTTP, a web browser, for example, acts as a client, while an application running on a computer hosting a web site functions as a server. The client submits an HTTP request message to the server. The server, which stores content, or provides resources, such as HTML files and images, or generates such content on the fly, or performs other functions on behalf of the client, returns a response message to the client. A response contains completion status information about the request and may contain any content requested by the client in its message body.
HTTP Close mode - Traditionally, a TCP connection is established from the client to the server, a request is sent by the client on the connection, the server responds and the connection is closed. A new request will involve a new connection. In HTTP/0.9 and 1.0, the connection is closed after a single request/response pair.
[CON1] [REQ1] ... [RESP1] [CLO1] [CON2] [REQ2] ... [RESP2] [CLO2] ...
Keep Alive mode - The client does not need to re-negotiate the TCP connection after the first request has been sent. In this mode however, it is mandatory that the server indicates the content length for each response so that the client does not wait indefinitely. For this, a special header is used: "Content-length". Its advantages are a reduced latency between transactions, and less processing power required on the server side. It is generally better than the close mode, but not always because the clients often limit their concurrent connections to a smaller value.
[CON] [REQ1] ... [RESP1] [REQ2] ... [RESP2] [CLO] ...
Pipelining mode - Allowing clients to send multiple requests before a previous response has been received to the first one. This is useful for fetching large number of images composing a page. Many HTTP agents do notcorrectly support pipelining since there is no way to associate a response with the corresponding request in HTTP. For this reason, it is mandatory for the server to reply in the exact same order as the requests were received.
[CON] [REQ1] [REQ2] ... [RESP1] [RESP2] [CLO] ...