Proposal Details
I'm create a tls fork for kernel provided tls.
But net/http
requires a *tls.Conn to upgrade TLSNextProtos
In http/2, If the connection implement a method ConnectionState like tls.Conn. It will be ok.
So can we check it implement ConnectionState for upgrading?
This may require adding a new fields named NextProto, but use net.Conn instead of *tls.Conn
Maybe when we upgrade to crypto/tls/v2
it should turn Conn into an interface
I'm really fed up with creating a fork for every library that is heavily coupled to crypto/tls.Conn
Comment From: rbqvq
Can we implement an option for NextProto for non-tls connection?
It will have a new interface.
e.g.
type NextProto interface {
NegotiatedProtocol() string
}
type Transport struct {
...
NextProto map[string]func(authority string, conn net.Conn) RoundTripper
...
}
We preferentially assert whether it is *tls. Conn, and use it if it is and TLSNextProto has a protocol upgrade
Otherwise we should try to NextProto again.
Also, remember to add the registration to NextProto in the http2 package.
Comment From: gabyhelp
Related Issues
- proposal: net/http: support TLS interface for HTTP/2 #64359 (closed)
- proposal: net/http: allow use of external TLS stacks #21753 (closed)
Related Code Changes
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)