I have some doubts about the usefulness of Server.ConnContext, given that 
it exposes the underlying network connection.

IMHO, the only things that can be obtained by net.Conn are the local 
address (already in LocalAddrContextKey) and the remote address and the TLS 
info (already in Request).
The only advantage of ConnContext is that it will be called before all the 
handlers.
Am I missing something?  https://github.com/golang/go/issues/30694 does not 
seem to list some useful usage.

On the other way, ConnContext can easily be abused:
https://play.golang.org/p/034zB3K-mTL

The use case of the example is an handler that want to return an SSE 
response.
To avoid abuse, Server.WriteTimeout is not useful.  Instead a per write 
timeout is required, as it is done by Nginx 
https://nginx.org/en/docs/http/ngx_http_core_module.html#send_timeout.


Thanks
Manlio Perillo

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6d91b90c-49fa-4421-b99a-3369bcd4e692%40googlegroups.com.

Reply via email to