Skip to content

Commit 9fe67ce

Browse files
committed
make SSLv23 the default version in ftplib (closes #23111)
1 parent c1edb58 commit 9fe67ce

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

Doc/library/ftplib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ FTP_TLS Objects
384384

385385
.. attribute:: FTP_TLS.ssl_version
386386

387-
The SSL version to use (defaults to *TLSv1*).
387+
The SSL version to use (defaults to :attr:`ssl.PROTOCOL_SSLv23`).
388388

389389
.. method:: FTP_TLS.auth()
390390

Lib/ftplib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ class FTP_TLS(FTP):
638638
'221 Goodbye.'
639639
>>>
640640
'''
641-
ssl_version = ssl.PROTOCOL_TLSv1
641+
ssl_version = ssl.PROTOCOL_SSLv23
642642

643643
def __init__(self, host='', user='', passwd='', acct='', keyfile=None,
644644
certfile=None, timeout=_GLOBAL_DEFAULT_TIMEOUT):
@@ -656,7 +656,7 @@ def auth(self):
656656
'''Set up secure control connection by using TLS/SSL.'''
657657
if isinstance(self.sock, ssl.SSLSocket):
658658
raise ValueError("Already using TLS")
659-
if self.ssl_version == ssl.PROTOCOL_TLSv1:
659+
if self.ssl_version >= ssl.PROTOCOL_SSLv23:
660660
resp = self.voidcmd('AUTH TLS')
661661
else:
662662
resp = self.voidcmd('AUTH SSL')

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Core and Builtins
1515
Library
1616
-------
1717

18+
- Issue #23111: Maximize compatibility in protocol versions of ftplib.FTP_TLS.
19+
1820
- Issue #23112: Fix SimpleHTTPServer to correctly carry the query string and
1921
fragment when it redirects to add a trailing slash.
2022

0 commit comments

Comments
 (0)