Update SSL connectivity to use tls.Dial now it supports a config arg.

This commit is contained in:
Alex Bramley 2011-07-21 22:00:45 +01:00
parent 9748f9c47e
commit a5a4f989ac
1 changed files with 2 additions and 12 deletions

View File

@ -114,18 +114,8 @@ func (conn *Conn) Connect(host string, pass ...string) os.Error {
if !hasPort(host) {
host += ":6697"
}
// It's unfortunate that tls.Dial doesn't allow a tls.Config arg,
// so we simply replicate it here with the correct Config.
// http://codereview.appspot.com/2883041
if s, err := net.Dial("tcp", host); err == nil {
// Passing nil config => certs are validated.
c := tls.Client(s, conn.SSLConfig)
if err = c.Handshake(); err == nil {
conn.sock = c
} else {
s.Close()
return err
}
if s, err := tls.Dial("tcp", host, conn.SSLConfig); err == nil {
conn.sock = s
} else {
return err
}