Skip to content

Commit f49bb59

Browse files
[3.15] gh-161763: Correct SSL docs for unconnected client sockets (#GH-61772) (#161838)
gh-161763: Correct SSL docs for unconnected client sockets (#GH-61772) * gh-161763: Correct SSL docs for unconnected client sockets * gh-161763: Qualify SSL socket method references (cherry picked from commit f112215) Co-authored-by: Damian Shaw <damian.peter.shaw@gmail.com>
1 parent 9a52edb commit f49bb59

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎Doc/library/ssl.rst‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ Client socket example with custom context and IPv4::
101101

102102
with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as sock:
103103
with context.wrap_socket(sock, server_hostname=hostname) as ssock:
104+
ssock.connect((hostname, 443))
104105
print(ssock.version())
105106

106107

@@ -1949,13 +1950,12 @@ to speed up repeated connections from the same clients.
19491950
The parameter ``server_side`` is a boolean which identifies whether
19501951
server-side or client-side behavior is desired from this socket.
19511952

1952-
For client-side sockets, the context construction is lazy; if the
1953-
underlying socket isn't connected yet, the context construction will be
1954-
performed after :meth:`connect` is called on the socket. For
1955-
server-side sockets, if the socket has no remote peer, it is assumed
1953+
For client-side sockets, if *sock* is not yet connected, the underlying
1954+
SSL object is created when :meth:`~socket.socket.connect` is called.
1955+
For server-side sockets, if the socket has no remote peer, it is assumed
19561956
to be a listening socket, and the server-side SSL wrapping is
19571957
automatically performed on client connections accepted via the
1958-
:meth:`accept` method. The method may raise :exc:`SSLError`.
1958+
:meth:`~socket.socket.accept` method. The method may raise :exc:`SSLError`.
19591959

19601960
On client connections, the optional parameter *server_hostname* specifies
19611961
the hostname of the service which we are connecting to. This allows a

0 commit comments

Comments
 (0)