Fix XMPP TLS config

This commit is contained in:
Wichert Akkerman 2019-10-12 20:47:16 +02:00 committed by Mickaël Rémond
parent 87ff01ac68
commit d0f2b492ac

View file

@ -35,11 +35,13 @@ func (t XMPPTransport) IsSecure() bool {
func (t *XMPPTransport) StartTLS(domain string) error { func (t *XMPPTransport) StartTLS(domain string) error {
if t.Config.TLSConfig == nil { if t.Config.TLSConfig == nil {
t.Config.TLSConfig = &tls.Config{} t.TLSConfig = &tls.Config{}
} else {
t.TLSConfig = t.Config.TLSConfig.Clone()
} }
if t.Config.TLSConfig.ServerName == "" { if t.TLSConfig.ServerName == "" {
t.Config.TLSConfig.ServerName = domain t.TLSConfig.ServerName = domain
} }
tlsConn := tls.Client(t.conn, t.TLSConfig) tlsConn := tls.Client(t.conn, t.TLSConfig)
// We convert existing connection to TLS // We convert existing connection to TLS