Add drain_and_close_socket()
Apparently on some platforms immediately closing a client socket
with both unread and written-but-not-yet-transmitted data may result
in the connection being teared down prematurely, in which case
the client ends up with an incomplete response.
To prevent this, drain_and_close_socket() shuts down our side of
the connection (on platforms with shutdown()), drains the unread
data on the socket and finally calls close_socket().
I suspect that this was the main cause of the page truncation
issues reported with Opera in #
3464439.