Keep-Alive: 300
Proxy-Connection: keep-alive
As we know HTTP connection is closed when the request gets responded,so what does it mean by keep-alive
,can someone elaborate this?
This means it is OK to keep the connection open to ask for more resources like for example images and stylesheets.
As we know HTTP connection is closed when the request gets responded
What is an HTTP connection? Actually, it's a socket connection over which HTTP is implemented. Only in HTTP1.0 does the connection get closed after each response. In order to save on the cost of setting up a TCP/IP connection, HTTP1.1 specifies that unless the client sends a header
Connection:close
or the server comes back with the same header, then the socket remains open. You can feed as many requests as you want into this socket and the responses will come back in the order that they were requested. This requires that the response is either sent with a chunked transfer encoding or contains a content-length header so that the end of each response can be detected/calculated.
The proxy-connection
header is different again, and is related only to the conversation between client and proxy servers.
I'd recommend this page as an excellent guide to the protocol.
HTTP Made Really Easy
This question is already answered and accepted, but I would like to explain in details:
Keep-alive cannot maintain one connection forever; the application running in the server determines the limit with which to keep the connection alive for, and in most cases you can configure this limit.
In HTTP/1.1, Keep-alive is used by default. If clients have additional requests, they will use the same connection for them.
The term stateless doesn't mean that the server has no ability to keep a connection. It simply means that the server doesn't recognize any relationships between any two requests.
The protocol is indeed stateless, but keep-alive indicates that the connection should be kept open between the client and server.
Opening a TCP connection is a relatively heavyweight operation, and keeping that connection open avoids the setup and teardown cost associated with opening a new connection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With