Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
PEP 748: materialize the server context
Ease reading the diff of the next commits.
  • Loading branch information
Julien00859 committed Apr 28, 2026
commit 539e879939c2682ff35d1300ea6f30c0a64ca13f
31 changes: 30 additions & 1 deletion peps/pep-0748.rst
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,36 @@ The ``ClientContext`` protocol class has the following class definition:
(cipher, negotiated_protocol, negotiated_tls_version, etc.)."""
...

The ``ServerContext`` is similar, taking a ``TLSServerConfiguration`` instead.
The ``ServerContext`` protocol class has the following class definition:

.. code-block:: python

class ServerContext(Protocol):
@abstractmethod
def __init__(self, configuration: TLSServerConfiguration) -> None:
"""Create a new server context object from a given TLS server configuration."""
...

@property
@abstractmethod
def configuration(self) -> TLSServerConfiguration:
"""Returns the TLS server configuration that was used to create the server context."""
...

@abstractmethod
def connect(self, address: tuple[str | None, int]) -> TLSSocket:
"""Creates a TLSSocket that behaves like a socket.socket, and
contains information about the TLS exchange
(cipher, negotiated_protocol, negotiated_tls_version, etc.).
"""
...

@abstractmethod
def create_buffer(self, server_hostname: str) -> TLSBuffer:
"""Creates a TLSBuffer that acts as an in-memory channel,
and contains information about the TLS exchange
(cipher, negotiated_protocol, negotiated_tls_version, etc.)."""
...

Socket
~~~~~~
Expand Down