mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #28022: Deprecate ssl-related arguments in favor of SSLContext.
The deprecation include manual creation of SSLSocket and certfile/keyfile (or similar) in ftplib, httplib, imaplib, smtplib, poplib and urllib. ssl.wrap_socket() is not marked as deprecated yet.
This commit is contained in:
parent
130bbe5fd3
commit
d04863771b
23 changed files with 189 additions and 85 deletions
|
@ -311,10 +311,12 @@ if ssl is not None:
|
|||
_ssl_closing = False
|
||||
|
||||
def secure_connection(self):
|
||||
socket = ssl.wrap_socket(self.socket, suppress_ragged_eofs=False,
|
||||
certfile=CERTFILE, server_side=True,
|
||||
do_handshake_on_connect=False,
|
||||
ssl_version=ssl.PROTOCOL_SSLv23)
|
||||
context = ssl.SSLContext()
|
||||
context.load_cert_chain(CERTFILE)
|
||||
socket = context.wrap_socket(self.socket,
|
||||
suppress_ragged_eofs=False,
|
||||
server_side=True,
|
||||
do_handshake_on_connect=False)
|
||||
self.del_channel()
|
||||
self.set_socket(socket)
|
||||
self._ssl_accepting = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue