MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / stls

Method stls

tools/python-3.11.9-amd64/Lib/poplib.py:395–414  ·  view source on GitHub ↗

Start a TLS session on the active connection as specified in RFC 2595. context - a ssl.SSLContext

(self, context=None)

Source from the content-addressed store, hash-verified

393
394
395 def stls(self, context=None):
396 """Start a TLS session on the active connection as specified in RFC 2595.
397
398 context - a ssl.SSLContext
399 """
400 if not HAVE_SSL:
401 raise error_proto('-ERR TLS support missing')
402 if self._tls_established:
403 raise error_proto('-ERR TLS session already established')
404 caps = self.capa()
405 if not 'STLS' in caps:
406 raise error_proto('-ERR STLS not supported by server')
407 if context is None:
408 context = ssl._create_stdlib_context()
409 resp = self._shortcmd('STLS')
410 self.sock = context.wrap_socket(self.sock,
411 server_hostname=self.host)
412 self.file = self.sock.makefile('rb')
413 self._tls_established = True
414 return resp
415
416
417if HAVE_SSL:

Callers

nothing calls this directly

Calls 5

capaMethod · 0.95
_shortcmdMethod · 0.95
error_protoClass · 0.70
wrap_socketMethod · 0.45
makefileMethod · 0.45

Tested by

no test coverage detected