[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Premature eof-object ?



Matthew Flatt writes:
> Are HTTP clients obliged to keep both halves of the TCP connection
> open? Or is it just that a browser implemented directly with sockets
> wouldn't bother closing half of the connection, so Yahoo can be
> agressive about shutting down connections at the least provocation?

The HTTP 1.1 specification, RFC 2068, was written by people who don't
know that half-open connections existed, so it's not surprising that
some HTTP servers are written by people who don't know that half-open
connections exist.  From page 32, on how to tell when you've received
the end of an HTTP message:

   5. By the server closing the connection. (Closing the connection
     cannot be used to indicate the end of a request body, since that
     would leave no possibility for the server to send back a response.)

TCP doesn't really have a good way of determining when the other end
has ceased to listen --- except that if you send some data to it, your
OS will eventually realize that it has ceased to listen, and the next
time after that that you try to send it more data, you'll get an
error.  So it's arguably sensible to treat FIN from the client as a
closed connection.