Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1905)

Delta Between Two Patch Sets: Lib/asyncio/selector_events.py

Issue 19689: ssl.create_default_context()
Left Patch Set: Created 5 years, 4 months ago
Right Patch Set: Created 5 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | Lib/ftplib.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 """Event loop using a selector and related classes. 1 """Event loop using a selector and related classes.
2 2
3 A selector is a "notify-when-ready" multiplexer. For a subclass which 3 A selector is a "notify-when-ready" multiplexer. For a subclass which
4 also includes support for signal handling, see the unix_events sub-module. 4 also includes support for signal handling, see the unix_events sub-module.
5 """ 5 """
6 6
7 import collections 7 import collections
8 import errno 8 import errno
9 import socket 9 import socket
10 try: 10 try:
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 if server_side: 565 if server_side:
566 if not sslcontext: 566 if not sslcontext:
567 raise ValueError('Server side ssl needs a valid SSLContext') 567 raise ValueError('Server side ssl needs a valid SSLContext')
568 else: 568 else:
569 if not sslcontext: 569 if not sslcontext:
570 # Client side may pass ssl=True to use a default 570 # Client side may pass ssl=True to use a default
571 # context; in that case the sslcontext passed is None. 571 # context; in that case the sslcontext passed is None.
572 # The default is the same as used by urllib with 572 # The default is the same as used by urllib with
573 # cadefault=True. 573 # cadefault=True.
574 sslcontext = ssl.create_default_context( 574 sslcontext = ssl.create_default_context(
575 verify_mode=ssl.CERT_REQUIRED) 575 cert_reqs=ssl.CERT_REQUIRED)
576 sslcontext.set_default_verify_paths()
577 576
578 wrap_kwargs = { 577 wrap_kwargs = {
579 'server_side': server_side, 578 'server_side': server_side,
580 'do_handshake_on_connect': False, 579 'do_handshake_on_connect': False,
581 } 580 }
582 if server_hostname and not server_side and ssl.HAS_SNI: 581 if server_hostname and not server_side and ssl.HAS_SNI:
583 wrap_kwargs['server_hostname'] = server_hostname 582 wrap_kwargs['server_hostname'] = server_hostname
584 sslsock = sslcontext.wrap_socket(rawsock, **wrap_kwargs) 583 sslsock = sslcontext.wrap_socket(rawsock, **wrap_kwargs)
585 584
586 super().__init__(loop, sslsock, protocol, extra, server) 585 super().__init__(loop, sslsock, protocol, extra, server)
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 return 826 return
828 except Exception as exc: 827 except Exception as exc:
829 self._fatal_error(exc) 828 self._fatal_error(exc)
830 return 829 return
831 830
832 self._maybe_resume_protocol() # May append to buffer. 831 self._maybe_resume_protocol() # May append to buffer.
833 if not self._buffer: 832 if not self._buffer:
834 self._loop.remove_writer(self._sock_fd) 833 self._loop.remove_writer(self._sock_fd)
835 if self._closing: 834 if self._closing:
836 self._call_connection_lost(None) 835 self._call_connection_lost(None)
LEFTRIGHT
« no previous file | Lib/ftplib.py » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+