MCPcopy Index your code
hub / github.com/RustPython/RustPython / stls

Method stls

Lib/poplib.py:406–425  ·  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

404
405
406 def stls(self, context=None):
407 """Start a TLS session on the active connection as specified in RFC 2595.
408
409 context - a ssl.SSLContext
410 """
411 if not HAVE_SSL:
412 raise error_proto('-ERR TLS support missing')
413 if self._tls_established:
414 raise error_proto('-ERR TLS session already established')
415 caps = self.capa()
416 if not 'STLS' in caps:
417 raise error_proto('-ERR STLS not supported by server')
418 if context is None:
419 context = ssl._create_stdlib_context()
420 resp = self._shortcmd('STLS')
421 self.sock = context.wrap_socket(self.sock,
422 server_hostname=self.host)
423 self.file = self.sock.makefile('rb')
424 self._tls_established = True
425 return resp
426
427
428if HAVE_SSL:

Callers 3

test_stlsMethod · 0.45
test_stls_contextMethod · 0.45
setUpMethod · 0.45

Calls 5

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

Tested by 3

test_stlsMethod · 0.36
test_stls_contextMethod · 0.36
setUpMethod · 0.36