Skip to content

Commit

Permalink
[PR #8098/aca206fc backport][3.9] Fix backwards compatibility with ssl (
Browse files Browse the repository at this point in the history
#8101)

**This is a backport of PR #8098 as merged into 3.10
(aca206f).**

Fixes #8097.

Co-authored-by: Sam Bull <[email protected]>
  • Loading branch information
patchback[bot] and Dreamsorcerer authored Jan 29, 2024
1 parent 33f49e8 commit 5637e8f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES/8097.bugfix.rst
2 changes: 2 additions & 0 deletions CHANGES/8098.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed backwards compatibility breakage of ``ssl`` parameter when set outside of
``ClientSession`` (e.g. directly in ``TCPConnector``) -- by :user:`Dreamsorcerer`.
2 changes: 2 additions & 0 deletions aiohttp/client_reqrep.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ def _merge_ssl_params(
ssl_context: Optional["SSLContext"],
fingerprint: Optional[bytes],
) -> Union["SSLContext", bool, Fingerprint]:
if ssl is None:
ssl = True # Double check for backwards compatibility
if verify_ssl is not None and not verify_ssl:
warnings.warn(
"verify_ssl is deprecated, use ssl=False instead",
Expand Down
5 changes: 5 additions & 0 deletions tests/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -2001,6 +2001,11 @@ async def test_default_use_dns_cache() -> None:
assert conn.use_dns_cache


async def test_ssl_none() -> None:
conn = aiohttp.TCPConnector(ssl=None)
assert conn._ssl is True


async def test_resolver_not_called_with_address_is_ip(loop) -> None:
resolver = mock.MagicMock()
connector = aiohttp.TCPConnector(resolver=resolver)
Expand Down

0 comments on commit 5637e8f

Please sign in to comment.