forked from jshiffer/go-xmpp
Only check the certificate's host name if InsecureSkipVerify is not set.
This commit is contained in:
parent
7a8cf41551
commit
1ff5be0d01
10
xmpp.go
10
xmpp.go
@ -176,8 +176,14 @@ func (o Options) NewClient() (*Client, error) {
|
|||||||
if strings.LastIndex(o.Host, ":") > 0 {
|
if strings.LastIndex(o.Host, ":") > 0 {
|
||||||
host = host[:strings.LastIndex(o.Host, ":")]
|
host = host[:strings.LastIndex(o.Host, ":")]
|
||||||
}
|
}
|
||||||
if err = tlsconn.VerifyHostname(host); err != nil {
|
insecureSkipVerify := DefaultConfig.InsecureSkipVerify
|
||||||
return nil, err
|
if o.TLSConfig != nil {
|
||||||
|
insecureSkipVerify = o.TLSConfig.InsecureSkipVerify
|
||||||
|
}
|
||||||
|
if !insecureSkipVerify {
|
||||||
|
if err = tlsconn.VerifyHostname(host); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
client.conn = tlsconn
|
client.conn = tlsconn
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user