mirror of
https://github.com/python/cpython.git
synced 2025-10-08 08:01:55 +00:00
Issue #19781: ftplib now supports SSLContext.check_hostname and server name
indication for TLS/SSL connections.
This commit is contained in:
parent
1aa9a75fbf
commit
e5b5edfa2c
4 changed files with 51 additions and 3 deletions
|
@ -748,7 +748,9 @@ else:
|
|||
resp = self.voidcmd('AUTH TLS')
|
||||
else:
|
||||
resp = self.voidcmd('AUTH SSL')
|
||||
self.sock = self.context.wrap_socket(self.sock)
|
||||
server_hostname = self.host if ssl.HAS_SNI else None
|
||||
self.sock = self.context.wrap_socket(self.sock,
|
||||
server_hostname=server_hostname)
|
||||
self.file = self.sock.makefile(mode='r', encoding=self.encoding)
|
||||
return resp
|
||||
|
||||
|
@ -787,7 +789,9 @@ else:
|
|||
def ntransfercmd(self, cmd, rest=None):
|
||||
conn, size = FTP.ntransfercmd(self, cmd, rest)
|
||||
if self._prot_p:
|
||||
conn = self.context.wrap_socket(conn)
|
||||
server_hostname = self.host if ssl.HAS_SNI else None
|
||||
conn = self.context.wrap_socket(conn,
|
||||
server_hostname=server_hostname)
|
||||
return conn, size
|
||||
|
||||
def abort(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue