Keepin' Alive --#-- The response that Yahoo sends back is, simply, a header and an HTML page. If there are references to images embeded in the HTML (<img src=clear.gif>), the browser must make another GET request for each one it finds.

This can be slow. To speed things up, most browsers will send a Connection header in their requests, telling the server to keep the line open until the browser has finished making all its requests. On this next example, we're going to use the HEAD method, so you'll just get the headers:

HEAD / HTTP/1.0 Connection: Keep-Alive
You'll notice that the connection remains open. You can immediately type a new request, and send it back. You can keep this up until you tell the server you're through by changing your Connection header to Connection: close

If you just send a Connection: close header by itself, you'll likely get a "400 Bad Request" response from the server. Make a valid request, closing the connection as you do so:

HTTP/1.1 200 OK Date: Fri, 01 Oct 1999 00:57:02 GMT Server: Apache/1.3.6 (Unix) Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/html HEAD / HTTP/1.0 Connection: close HTTP/1.1 200 OK Date: Fri, 01 Oct 1999 00:57:09 GMT Server: Apache/1.3.6 (Unix) Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/html Connection closed by foreign host.
The Keep-Alive connection has become so prevalent and even necessary to the way the Web operates now that it is the default connection type in the new HTTP/1.1 protocol version. As we will see shortly, the major Web servers already use HTTP/1.1 in their responses, and even Microsoft's Internet Explorer 4.0 and above browsers use it for non-proxied requests.