mirror of https://github.com/fluffle/goirc
Update SSL connectivity to use tls.Dial now it supports a config arg.
This commit is contained in:
parent
9748f9c47e
commit
a5a4f989ac
|
@ -114,18 +114,8 @@ func (conn *Conn) Connect(host string, pass ...string) os.Error {
|
||||||
if !hasPort(host) {
|
if !hasPort(host) {
|
||||||
host += ":6697"
|
host += ":6697"
|
||||||
}
|
}
|
||||||
// It's unfortunate that tls.Dial doesn't allow a tls.Config arg,
|
if s, err := tls.Dial("tcp", host, conn.SSLConfig); err == nil {
|
||||||
// so we simply replicate it here with the correct Config.
|
conn.sock = s
|
||||||
// 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
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue