Description
A Handler
has no way of changing the underlying connection Deadline, since it has no access to the net.Conn
(except by maintaining a map from RemoteAddr
to net.Conn
via Server.ConnState
, but it's more than anyone should need to do). Moreover, it can't implement a timeout itself because the Close
method of the ResponseWriter
implementation is not documented to unblock concurrent Write
s.
This means that if the server has a WriteTimeout, the connection has a definite lifespan, and streaming is impossible. So servers with any streaming endpoints are forced not to implement timeouts at all on the entire Server.
A possible solution might be to expose the net.Conn in the Context. Another could be to allow interface upgrades to the SetDeadline
methods on ResponseWriter. Yet another would be to make (*response).Close
unblock (*response).Write
.