@@ -1727,6 +1727,11 @@ func (pconn *persistConn) addTLS(ctx context.Context, name string, trace *httptr
1727
1727
return nil
1728
1728
}
1729
1729
1730
+ type tlsConn interface {
1731
+ HandshakeContext (ctx context.Context ) error
1732
+ ConnectionState () tls.ConnectionState
1733
+ }
1734
+
1730
1735
type erringRoundTripper interface {
1731
1736
RoundTripErr () error
1732
1737
}
@@ -1757,7 +1762,7 @@ func (t *Transport) dialConn(ctx context.Context, cm connectMethod) (pconn *pers
1757
1762
if err != nil {
1758
1763
return nil , wrapErr (err )
1759
1764
}
1760
- if tc , ok := pconn .conn .(* tls. Conn ); ok {
1765
+ if tc , ok := pconn .conn .(tlsConn ); ok {
1761
1766
// Handshake here, in case DialTLS didn't. TLSNextProto below
1762
1767
// depends on it for knowing the connection state.
1763
1768
if trace != nil && trace .TLSHandshakeStart != nil {
@@ -1928,13 +1933,17 @@ func (t *Transport) dialConn(ctx context.Context, cm connectMethod) (pconn *pers
1928
1933
}
1929
1934
1930
1935
if s := pconn .tlsState ; s != nil && s .NegotiatedProtocolIsMutual && s .NegotiatedProtocol != "" {
1931
- if next , ok := t .TLSNextProto [s .NegotiatedProtocol ]; ok {
1932
- alt := next (cm .targetAddr , pconn .conn .(* tls.Conn ))
1933
- if e , ok := alt .(erringRoundTripper ); ok {
1934
- // pconn.conn was closed by next (http2configureTransports.upgradeFn).
1935
- return nil , e .RoundTripErr ()
1936
+ // New HTTP/2 Handler at https://go-review.googlesource.com/c/go/+/616097/2/src/net/http/transport.go
1937
+
1938
+ if tc , ok := pconn .conn .(* tls.Conn ); ok {
1939
+ if next , ok := t .TLSNextProto [s .NegotiatedProtocol ]; ok {
1940
+ alt := next (cm .targetAddr , tc )
1941
+ if e , ok := alt .(erringRoundTripper ); ok {
1942
+ // pconn.conn was closed by next (http2configureTransports.upgradeFn).
1943
+ return nil , e .RoundTripErr ()
1944
+ }
1945
+ return & persistConn {t : t , cacheKey : pconn .cacheKey , alt : alt }, nil
1936
1946
}
1937
- return & persistConn {t : t , cacheKey : pconn .cacheKey , alt : alt }, nil
1938
1947
}
1939
1948
}
1940
1949
0 commit comments