mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Issue #19422: Explicitly disallow non-SOCK_STREAM sockets in the ssl module, rather than silently let them emit clear text data.
This commit is contained in:
parent
ecff5e51a5
commit
3e86ba4e32
4 changed files with 34 additions and 8 deletions
|
@ -141,13 +141,16 @@ instead.
|
|||
|
||||
Takes an instance ``sock`` of :class:`socket.socket`, and returns an instance
|
||||
of :class:`ssl.SSLSocket`, a subtype of :class:`socket.socket`, which wraps
|
||||
the underlying socket in an SSL context. For client-side sockets, the
|
||||
context construction is lazy; if the underlying socket isn't connected yet,
|
||||
the context construction will be performed after :meth:`connect` is called on
|
||||
the socket. For server-side sockets, if the socket has no remote peer, it is
|
||||
assumed to be a listening socket, and the server-side SSL wrapping is
|
||||
automatically performed on client connections accepted via the :meth:`accept`
|
||||
method. :func:`wrap_socket` may raise :exc:`SSLError`.
|
||||
the underlying socket in an SSL context. ``sock`` must be a
|
||||
:data:`~socket.SOCK_STREAM` socket; other socket types are unsupported.
|
||||
|
||||
For client-side sockets, the context construction is lazy; if the
|
||||
underlying socket isn't connected yet, the context construction will be
|
||||
performed after :meth:`connect` is called on the socket. For
|
||||
server-side sockets, if the socket has no remote peer, it is assumed
|
||||
to be a listening socket, and the server-side SSL wrapping is
|
||||
automatically performed on client connections accepted via the
|
||||
:meth:`accept` method. :func:`wrap_socket` may raise :exc:`SSLError`.
|
||||
|
||||
The ``keyfile`` and ``certfile`` parameters specify optional files which
|
||||
contain a certificate to be used to identify the local side of the
|
||||
|
@ -836,7 +839,10 @@ to speed up repeated connections from the same clients.
|
|||
server_hostname=None)
|
||||
|
||||
Wrap an existing Python socket *sock* and return an :class:`SSLSocket`
|
||||
object. The SSL socket is tied to the context, its settings and
|
||||
object. *sock* must be a :data:`~socket.SOCK_STREAM` socket; other socket
|
||||
types are unsupported.
|
||||
|
||||
The returned SSL socket is tied to the context, its settings and
|
||||
certificates. The parameters *server_side*, *do_handshake_on_connect*
|
||||
and *suppress_ragged_eofs* have the same meaning as in the top-level
|
||||
:func:`wrap_socket` function.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue