Skip to content

Commit 5268cf6

Browse files
authored
Merge branch 'master' into DRIVERS-3081
2 parents e41c377 + 820701f commit 5268cf6

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

pymongo/network_layer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
async def async_sendall(sock: Union[socket.socket, _sslConn], buf: bytes) -> None:
7373
timeout = sock.gettimeout()
7474
sock.settimeout(0.0)
75-
loop = asyncio.get_event_loop()
75+
loop = asyncio.get_running_loop()
7676
try:
7777
if _HAVE_SSL and isinstance(sock, (SSLSocket, _sslConn)):
7878
await asyncio.wait_for(_async_sendall_ssl(sock, buf, loop), timeout=timeout)
@@ -259,7 +259,7 @@ async def async_receive_data(
259259
timeout = sock_timeout
260260

261261
sock.settimeout(0.0)
262-
loop = asyncio.get_event_loop()
262+
loop = asyncio.get_running_loop()
263263
cancellation_task = create_task(_poll_cancellation(conn))
264264
try:
265265
if _HAVE_SSL and isinstance(sock, (SSLSocket, _sslConn)):
@@ -290,7 +290,7 @@ async def async_receive_data_socket(
290290
timeout = sock_timeout
291291

292292
sock.settimeout(0.0)
293-
loop = asyncio.get_event_loop()
293+
loop = asyncio.get_running_loop()
294294
try:
295295
if _HAVE_SSL and isinstance(sock, (SSLSocket, _sslConn)):
296296
return await asyncio.wait_for(

pymongo/pyopenssl_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def __set_check_ocsp_endpoint(self, value: bool) -> None:
273273

274274
check_ocsp_endpoint = property(__get_check_ocsp_endpoint, __set_check_ocsp_endpoint)
275275

276-
def __get_options(self) -> None:
276+
def __get_options(self) -> int:
277277
# Calling set_options adds the option to the existing bitmask and
278278
# returns the new bitmask.
279279
# https://www.pyopenssl.org/en/stable/api/ssl.html#OpenSSL.SSL.Context.set_options

test/asynchronous/test_encryption.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2884,6 +2884,8 @@ async def http_post(self, path, data=None):
28842884
# each request because the server is single threaded.
28852885
ctx = ssl.create_default_context(cafile=CA_PEM)
28862886
ctx.load_cert_chain(CLIENT_PEM)
2887+
ctx.check_hostname = False
2888+
ctx.verify_mode = ssl.CERT_NONE
28872889
conn = http.client.HTTPSConnection("127.0.0.1:9003", context=ctx)
28882890
try:
28892891
if data is not None:

test/test_encryption.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2866,6 +2866,8 @@ def http_post(self, path, data=None):
28662866
# each request because the server is single threaded.
28672867
ctx = ssl.create_default_context(cafile=CA_PEM)
28682868
ctx.load_cert_chain(CLIENT_PEM)
2869+
ctx.check_hostname = False
2870+
ctx.verify_mode = ssl.CERT_NONE
28692871
conn = http.client.HTTPSConnection("127.0.0.1:9003", context=ctx)
28702872
try:
28712873
if data is not None:

0 commit comments

Comments
 (0)