Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tightening the runtime type check for ssl #7698

Merged
merged 54 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
af89acb
Not verify ssl cert only if it is explicitly set to false
xiangyan99 Oct 13, 2023
f950c10
update
xiangyan99 Oct 13, 2023
2a9c681
update
xiangyan99 Oct 16, 2023
9cfba08
Merge branch 'master' into fix_sslcontext
xiangyan99 Oct 16, 2023
3307165
Tightening the runtime type check for ssl
xiangyan99 Oct 17, 2023
39dd338
Merge branch 'fix_sslcontext' of https://github.com/xiangyan99/aiohtt…
xiangyan99 Oct 17, 2023
9cbfc19
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 17, 2023
1a4418f
update error message
xiangyan99 Oct 17, 2023
8c97799
Merge branch 'fix_sslcontext' of https://github.com/xiangyan99/aiohtt…
xiangyan99 Oct 17, 2023
6951153
refactor verify_ssl_type method
xiangyan99 Oct 18, 2023
f66fc1d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 18, 2023
4791edc
Update aiohttp/helpers.py
xiangyan99 Oct 18, 2023
7bb9f8f
Merge branch 'master' into fix_sslcontext
xiangyan99 Oct 19, 2023
53a981d
update
xiangyan99 Oct 19, 2023
de91f19
update
xiangyan99 Oct 19, 2023
ae3bc13
update
xiangyan99 Oct 19, 2023
9725feb
Update aiohttp/helpers.py
xiangyan99 Oct 19, 2023
e49e038
Update aiohttp/helpers.py
xiangyan99 Oct 19, 2023
94d4ad2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 19, 2023
5187a7d
Update aiohttp/client.py
xiangyan99 Nov 27, 2023
de3b3ea
Merge branch 'master' into fix_sslcontext
xiangyan99 Nov 27, 2023
2cce630
add test
xiangyan99 Nov 27, 2023
c391f2e
Merge branch 'master' into fix_sslcontext
xiangyan99 Nov 27, 2023
205146e
Use True as default value of ssl
xiangyan99 Nov 29, 2023
4252e61
Merge branch 'fix_sslcontext' of https://github.com/xiangyan99/aiohtt…
xiangyan99 Nov 29, 2023
6feee53
updates
xiangyan99 Nov 29, 2023
c420198
removing Literal import
xiangyan99 Nov 29, 2023
3c96983
Update aiohttp/connector.py
xiangyan99 Nov 30, 2023
c461001
Update aiohttp/client.py
xiangyan99 Nov 30, 2023
930ddc2
address feedback
xiangyan99 Dec 11, 2023
ee07c13
Merge branch 'master' into fix_sslcontext
xiangyan99 Dec 11, 2023
86734c9
update
xiangyan99 Dec 11, 2023
9f9d975
update
xiangyan99 Dec 11, 2023
30cde0c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 11, 2023
c2491d0
update
xiangyan99 Dec 11, 2023
a008c0e
Merge branch 'fix_sslcontext' of https://github.com/xiangyan99/aiohtt…
xiangyan99 Dec 11, 2023
f6784d8
update
xiangyan99 Dec 11, 2023
74c9c1a
update
xiangyan99 Dec 11, 2023
2a329c4
Update aiohttp/client_reqrep.py
xiangyan99 Dec 12, 2023
448cadd
update
xiangyan99 Dec 12, 2023
c499d25
add deprecation warning
xiangyan99 Jan 5, 2024
5ef43dd
Merge branch 'master' into fix_sslcontext
xiangyan99 Jan 5, 2024
67ed458
Create 7698.feature
Dreamsorcerer Jan 20, 2024
4b63a9a
Update client_exceptions.py
Dreamsorcerer Jan 20, 2024
7e9142e
Update client_reqrep.py
Dreamsorcerer Jan 20, 2024
ccee556
Update client.py
Dreamsorcerer Jan 20, 2024
6d90b5f
Update test_connector.py
Dreamsorcerer Jan 20, 2024
94a043b
Update test_proxy.py
Dreamsorcerer Jan 20, 2024
e2a511a
Update test_connector.py
Dreamsorcerer Jan 20, 2024
4e5c4a3
Update test_client_exceptions.py
Dreamsorcerer Jan 20, 2024
34d4e6b
Update test_client_request.py
Dreamsorcerer Jan 20, 2024
9eb658d
Update test_client_exceptions.py
Dreamsorcerer Jan 20, 2024
effc111
Apply suggestions from code review
Dreamsorcerer Jan 20, 2024
d4b1340
Update tests/test_connector.py
Dreamsorcerer Jan 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions aiohttp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,9 +784,13 @@ async def _ws_connect(
extstr = ws_ext_gen(compress=compress)
real_headers[hdrs.SEC_WEBSOCKET_EXTENSIONS] = extstr

if not isinstance(ssl, SSL_ALLOWED_TYPES):
# We need this code to keep backward compatibility. If ssl is True, we transform it to None
if ssl is True:
ssl = None
xiangyan99 marked this conversation as resolved.
Show resolved Hide resolved

if not isinstance(ssl, SSL_ALLOWED_TYPES) and ssl is not False:
xiangyan99 marked this conversation as resolved.
Show resolved Hide resolved
raise TypeError(
"ssl should be SSLContext, bool, Fingerprint, "
"ssl should be SSLContext, Fingerprint, "
"or None, got {!r} instead.".format(ssl)
)

Expand Down
2 changes: 1 addition & 1 deletion aiohttp/client_reqrep.py
Dreamsorcerer marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def check(self, transport: asyncio.Transport) -> None:


if ssl is not None:
SSL_ALLOWED_TYPES = (ssl.SSLContext, bool, Fingerprint, type(None))
Dreamsorcerer marked this conversation as resolved.
Show resolved Hide resolved
SSL_ALLOWED_TYPES = (ssl.SSLContext, Fingerprint, type(None))
else: # pragma: no cover
SSL_ALLOWED_TYPES = type(None)
xiangyan99 marked this conversation as resolved.
Show resolved Hide resolved

Expand Down