MCPcopy Index your code
hub / github.com/python/cpython / cmd_stls

Method cmd_stls

Lib/test/test_poplib.py:160–176  ·  view source on GitHub ↗
(self, arg)

Source from the content-addressed store, hash-verified

158 if SUPPORTS_SSL:
159
160 def cmd_stls(self, arg):
161 if self.tls_active is False:
162 self.push('+OK Begin TLS negotiation')
163 context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
164 context.load_cert_chain(CERTFILE)
165 tls_sock = context.wrap_socket(self.socket,
166 server_side=True,
167 do_handshake_on_connect=False,
168 suppress_ragged_eofs=False)
169 self.del_channel()
170 self.set_socket(tls_sock)
171 self.tls_active = True
172 self.tls_starting = True
173 self.in_buffer = []
174 self._do_tls_handshake()
175 else:
176 self.push('-ERR Command not permitted when TLS active')
177
178 def _do_tls_handshake(self):
179 try:

Callers

nothing calls this directly

Calls 5

pushMethod · 0.95
wrap_socketMethod · 0.95
_do_tls_handshakeMethod · 0.95
del_channelMethod · 0.80
set_socketMethod · 0.80

Tested by

no test coverage detected