i am now experimenting with designing a custom web/http server in c language(using gcc from codeblocks), and i am now learning about the keep-alive feature..
with keep-alive, when i telnet to google.com on port 80(telnet google.com 80), and then i issue a get request for "/"
GET / HTTP/1.1 [enter][enter]
the google server will return a response header AND it also returns the html for "/", BUT IT DOES NOT CLOSE THE CONNECTION..
I am now able to issue additional GET or HEAD requests, for example, using the same connection, the connection is not closed.. i am able to issue multiple requests:
GET / HTTP/1.1 or HEAD / HTTP/1.1
and it seems like i can go on and on issuing these requests...
if i stop submitting these requests, the google server closes the telnet connection after four minutes of inactivity.
my question is how does the connection get closed immediately when i make a request via browser after the page request is issued, and it does not wait four minutes?
what is it that causes this "keep-alive" session to terminate immediately by google after it returns http://google.com webpage?
thank you.