mirror of
https://github.com/golang/go
synced 2024-11-25 07:17:56 -07:00
http: support setting Transport's TLS client config
R=golang-dev, adg CC=golang-dev https://golang.org/cl/4964043
This commit is contained in:
parent
a45c657db1
commit
822804c600
@ -54,6 +54,10 @@ type Transport struct {
|
|||||||
// If Dial is nil, net.Dial is used.
|
// If Dial is nil, net.Dial is used.
|
||||||
Dial func(net, addr string) (c net.Conn, err os.Error)
|
Dial func(net, addr string) (c net.Conn, err os.Error)
|
||||||
|
|
||||||
|
// TLSClientConfig specifies the TLS configuration to use with
|
||||||
|
// tls.Client. If nil, the default configuration is used.
|
||||||
|
TLSClientConfig *tls.Config
|
||||||
|
|
||||||
DisableKeepAlives bool
|
DisableKeepAlives bool
|
||||||
DisableCompression bool
|
DisableCompression bool
|
||||||
|
|
||||||
@ -338,7 +342,7 @@ func (t *Transport) getConn(cm *connectMethod) (*persistConn, os.Error) {
|
|||||||
|
|
||||||
if cm.targetScheme == "https" {
|
if cm.targetScheme == "https" {
|
||||||
// Initiate TLS and check remote host name against certificate.
|
// Initiate TLS and check remote host name against certificate.
|
||||||
conn = tls.Client(conn, nil)
|
conn = tls.Client(conn, t.TLSClientConfig)
|
||||||
if err = conn.(*tls.Conn).Handshake(); err != nil {
|
if err = conn.(*tls.Conn).Handshake(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user