On 27/02/14 19:00, Brad Fitzpatrick wrote:
> I would read crypto/tls.NewListener and net/http.Server.Serve
>
> From my quick refresher reading now, the crypto/tls Listener raises no
> TLS-related failures at accept-time. The first error won't happen until
> the first read.
[snip]
> <mailto:
a...@golang.org>. There's probably something better we could do.
There seems to be a report about this already
https://code.google.com/p/go/issues/detail?id=7291
Which suggests the problem is the tlsConn.Handshake returning on error
without reporting it anywhere. There isn't a channel to return it at
that moment - a log.Printf would be helpful for debugging but might
not be the right thing to do.
http://golang.org/src/pkg/net/http/server.go?s=30995:31017#L1108
if tlsConn, ok := c.rwc.(*tls.Conn); ok {
if d := c.server.ReadTimeout; d != 0 {
c.rwc.SetReadDeadline(time.Now().Add(d))
}
if d := c.server.WriteTimeout; d != 0 {
c.rwc.SetWriteDeadline(time.Now().Add(d))
}
if err := tlsConn.Handshake(); err != nil {
// A log.Printf would be really helpful here!
return
}
c.tlsState = new(tls.ConnectionState)
*c.tlsState = tlsConn.ConnectionState()
if proto := c.tlsState.NegotiatedProtocol; validNPN(proto) {
if fn := c.server.TLSNextProto[proto]; fn != nil {
h := initNPNRequest{tlsConn, serverHandler{c.server}}
fn(c.server, tlsConn, h)
}
return