MCPcopy
hub / github.com/urllib3/urllib3 / __init__

Method __init__

src/urllib3/util/ssltransport.py:49–70  ·  view source on GitHub ↗

Create an SSLTransport around socket using the provided ssl_context.

(
        self,
        socket: socket.socket,
        ssl_context: ssl.SSLContext,
        server_hostname: str | None = None,
        suppress_ragged_eofs: bool = True,
    )

Source from the content-addressed store, hash-verified

47 )
48
49 def __init__(
50 self,
51 socket: socket.socket,
52 ssl_context: ssl.SSLContext,
53 server_hostname: str | None = None,
54 suppress_ragged_eofs: bool = True,
55 ) -> None:
56 """
57 Create an SSLTransport around socket using the provided ssl_context.
58 """
59 self.incoming = ssl.MemoryBIO()
60 self.outgoing = ssl.MemoryBIO()
61
62 self.suppress_ragged_eofs = suppress_ragged_eofs
63 self.socket = socket
64
65 self.sslobj = ssl_context.wrap_bio(
66 self.incoming, self.outgoing, server_hostname=server_hostname
67 )
68
69 # Perform initial handshake.
70 self._ssl_io_loop(self.sslobj.do_handshake)
71
72 def __enter__(self) -> Self:
73 return self

Callers

nothing calls this directly

Calls 1

_ssl_io_loopMethod · 0.95

Tested by

no test coverage detected