comparison mercurial/mail.py @ 43169:3941e7063d03

py3: call SMTP.has_extn() with an str Passing a bytes on Python 3 always returns False, thus starttls is not properly detected.
author Denis Laxalde <denis@laxalde.org>
date Thu, 10 Oct 2019 21:00:13 +0200
parents 0e6a7ce81dde
children a1801ee97840
comparison
equal deleted inserted replaced
43168:01e8eefd9434 43169:3941e7063d03
47 smtplib.SMTP.__init__(self, **kwargs) 47 smtplib.SMTP.__init__(self, **kwargs)
48 self._ui = ui 48 self._ui = ui
49 self._host = host 49 self._host = host
50 50
51 def starttls(self, keyfile=None, certfile=None): 51 def starttls(self, keyfile=None, certfile=None):
52 if not self.has_extn(b"starttls"): 52 if not self.has_extn("starttls"):
53 msg = b"STARTTLS extension not supported by server" 53 msg = b"STARTTLS extension not supported by server"
54 raise smtplib.SMTPException(msg) 54 raise smtplib.SMTPException(msg)
55 (resp, reply) = self.docmd(b"STARTTLS") 55 (resp, reply) = self.docmd(b"STARTTLS")
56 if resp == 220: 56 if resp == 220:
57 self.sock = sslutil.wrapsocket( 57 self.sock = sslutil.wrapsocket(