diff options
| author | Johan Brandhorst <johan.brandhorst@gmail.com> | 2020-11-12 20:34:51 +0000 |
|---|---|---|
| committer | Katie Hockman <katie@golang.org> | 2020-12-17 20:04:25 +0000 |
| commit | 520f3b72db7befab2028d9a47376267cf2d274a9 (patch) | |
| tree | 461fbaf1b007dc1a1f0e849286bf90f959916d4d /src/net/http | |
| parent | 2ff33f5e443165e55a080f3a649e4c070c4096d1 (diff) | |
| download | go-520f3b72db7befab2028d9a47376267cf2d274a9.tar.xz | |
crypto/tls: revert "add HandshakeContext method to Conn"
This reverts CL 246338.
Reason for revert: waiting for 1.17 release cycle
Updates #32406
Change-Id: I074379039041e086c62271d689b4b7f442281663
Reviewed-on: https://go-review.googlesource.com/c/go/+/269697
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Katie Hockman <katie@golang.org>
Trust: Roland Shoemaker <roland@golang.org>
Diffstat (limited to 'src/net/http')
| -rw-r--r-- | src/net/http/server.go | 2 | ||||
| -rw-r--r-- | src/net/http/transport.go | 10 | ||||
| -rw-r--r-- | src/net/http/transport_test.go | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/net/http/server.go b/src/net/http/server.go index 102e893d5f..ad99741177 100644 --- a/src/net/http/server.go +++ b/src/net/http/server.go @@ -1837,7 +1837,7 @@ func (c *conn) serve(ctx context.Context) { if d := c.server.WriteTimeout; d != 0 { c.rwc.SetWriteDeadline(time.Now().Add(d)) } - if err := tlsConn.HandshakeContext(ctx); err != nil { + if err := tlsConn.Handshake(); err != nil { // If the handshake failed due to the client not speaking // TLS, assume they're speaking plaintext HTTP and write a // 400 response on the TLS conn's underlying net.Conn. diff --git a/src/net/http/transport.go b/src/net/http/transport.go index 6358c3897e..0aa48273dd 100644 --- a/src/net/http/transport.go +++ b/src/net/http/transport.go @@ -1505,7 +1505,7 @@ func (t *Transport) decConnsPerHost(key connectMethodKey) { // Add TLS to a persistent connection, i.e. negotiate a TLS session. If pconn is already a TLS // tunnel, this function establishes a nested TLS session inside the encrypted channel. // The remote endpoint's name may be overridden by TLSClientConfig.ServerName. -func (pconn *persistConn) addTLS(ctx context.Context, name string, trace *httptrace.ClientTrace) error { +func (pconn *persistConn) addTLS(name string, trace *httptrace.ClientTrace) error { // Initiate TLS and check remote host name against certificate. cfg := cloneTLSConfig(pconn.t.TLSClientConfig) if cfg.ServerName == "" { @@ -1527,7 +1527,7 @@ func (pconn *persistConn) addTLS(ctx context.Context, name string, trace *httptr if trace != nil && trace.TLSHandshakeStart != nil { trace.TLSHandshakeStart() } - err := tlsConn.HandshakeContext(ctx) + err := tlsConn.Handshake() if timer != nil { timer.Stop() } @@ -1583,7 +1583,7 @@ func (t *Transport) dialConn(ctx context.Context, cm connectMethod) (pconn *pers if trace != nil && trace.TLSHandshakeStart != nil { trace.TLSHandshakeStart() } - if err := tc.HandshakeContext(ctx); err != nil { + if err := tc.Handshake(); err != nil { go pconn.conn.Close() if trace != nil && trace.TLSHandshakeDone != nil { trace.TLSHandshakeDone(tls.ConnectionState{}, err) @@ -1607,7 +1607,7 @@ func (t *Transport) dialConn(ctx context.Context, cm connectMethod) (pconn *pers if firstTLSHost, _, err = net.SplitHostPort(cm.addr()); err != nil { return nil, wrapErr(err) } - if err = pconn.addTLS(ctx, firstTLSHost, trace); err != nil { + if err = pconn.addTLS(firstTLSHost, trace); err != nil { return nil, wrapErr(err) } } @@ -1721,7 +1721,7 @@ func (t *Transport) dialConn(ctx context.Context, cm connectMethod) (pconn *pers } if cm.proxyURL != nil && cm.targetScheme == "https" { - if err := pconn.addTLS(ctx, cm.tlsHost(), trace); err != nil { + if err := pconn.addTLS(cm.tlsHost(), trace); err != nil { return nil, err } } diff --git a/src/net/http/transport_test.go b/src/net/http/transport_test.go index 7f6e0938c2..ba85a61683 100644 --- a/src/net/http/transport_test.go +++ b/src/net/http/transport_test.go @@ -3734,7 +3734,7 @@ func TestTransportDialTLSContext(t *testing.T) { if err != nil { return nil, err } - return c, c.HandshakeContext(ctx) + return c, c.Handshake() } req, err := NewRequest("GET", ts.URL, nil) |
