I am trying to use the http2.Server directly. I can't use the standard library http.Server because it has a hard dependency on receiving a *tls.Conn for http2 and I would like to use a wrapper. For now though, I am trying to get http2.Server working with the bare tls types. I am using what seems like the simplest way to use it, but it doesn't work and I am having trouble figuring out why. It seems that my handler is never executed and my browser returns ERR_CONNECTION_CLOSED.
Usage that doesn't work: > l, err := net.Listen("tcp", ":8443") > if err != nil { > panic(err) > } > l = tls.NewListener(l, &tls.Config{NextProtos: > []string{http2.NextProtoTLS}, Certificates: []tls.Certificate{rootTLSCert}}) > var srv http2.Server > opts := http2.ServeConnOpts{Handler: http.HandlerFunc(func(w > http.ResponseWriter, r *http.Request) { > w.Write([]byte("hello world")) > })} > for { > c, err := l.Accept() > // TODO: Handle temporary errors. > if err != nil { > panic(err) > } > go srv.ServeConn(c, &opts) > } -- 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/CANFXSj1K_JS4EnfmNNfDgiehGpxfTYJwCgybEzgCZ0tV3JBrVA%40mail.gmail.com.