Skip to content

Commit

Permalink
Merge branch 'master' into DRIVERS-3081
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaneHarvey authored Jan 16, 2025
2 parents e41c377 + 820701f commit 5268cf6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pymongo/network_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
async def async_sendall(sock: Union[socket.socket, _sslConn], buf: bytes) -> None:
timeout = sock.gettimeout()
sock.settimeout(0.0)
loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()
try:
if _HAVE_SSL and isinstance(sock, (SSLSocket, _sslConn)):
await asyncio.wait_for(_async_sendall_ssl(sock, buf, loop), timeout=timeout)
Expand Down Expand Up @@ -259,7 +259,7 @@ async def async_receive_data(
timeout = sock_timeout

sock.settimeout(0.0)
loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()
cancellation_task = create_task(_poll_cancellation(conn))
try:
if _HAVE_SSL and isinstance(sock, (SSLSocket, _sslConn)):
Expand Down Expand Up @@ -290,7 +290,7 @@ async def async_receive_data_socket(
timeout = sock_timeout

sock.settimeout(0.0)
loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()
try:
if _HAVE_SSL and isinstance(sock, (SSLSocket, _sslConn)):
return await asyncio.wait_for(
Expand Down
2 changes: 1 addition & 1 deletion pymongo/pyopenssl_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def __set_check_ocsp_endpoint(self, value: bool) -> None:

check_ocsp_endpoint = property(__get_check_ocsp_endpoint, __set_check_ocsp_endpoint)

def __get_options(self) -> None:
def __get_options(self) -> int:
# Calling set_options adds the option to the existing bitmask and
# returns the new bitmask.
# https://www.pyopenssl.org/en/stable/api/ssl.html#OpenSSL.SSL.Context.set_options
Expand Down
2 changes: 2 additions & 0 deletions test/asynchronous/test_encryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -2884,6 +2884,8 @@ async def http_post(self, path, data=None):
# each request because the server is single threaded.
ctx = ssl.create_default_context(cafile=CA_PEM)
ctx.load_cert_chain(CLIENT_PEM)
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
conn = http.client.HTTPSConnection("127.0.0.1:9003", context=ctx)
try:
if data is not None:
Expand Down
2 changes: 2 additions & 0 deletions test/test_encryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -2866,6 +2866,8 @@ def http_post(self, path, data=None):
# each request because the server is single threaded.
ctx = ssl.create_default_context(cafile=CA_PEM)
ctx.load_cert_chain(CLIENT_PEM)
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
conn = http.client.HTTPSConnection("127.0.0.1:9003", context=ctx)
try:
if data is not None:
Expand Down

0 comments on commit 5268cf6

Please sign in to comment.