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

verify strings are now correctly passed to aiohttp.TCPConnector #851

Merged
merged 1 commit into from
Feb 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions aiobotocore/endpoint.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import aiohttp
import asyncio
import io
import pathlib
import ssl
import aiohttp.http_exceptions
from aiohttp.client import URL
Expand Down Expand Up @@ -285,6 +286,7 @@ def create_endpoint(self, service_model, region_name, endpoint_url,
sock_read=read_timeout
)

verify = self._get_verify_value(verify)
ssl_context = None
if client_cert:
if isinstance(client_cert, str):
Expand All @@ -293,14 +295,18 @@ def create_endpoint(self, service_model, region_name, endpoint_url,
elif isinstance(client_cert, tuple):
cert_file, key_file = client_cert
else:
assert False
raise TypeError("client_cert must be str or tuple, not %s" %
client_cert.__class__.__name__)

ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
ssl_context.load_cert_chain(cert_file, key_file)
elif isinstance(verify, (str, pathlib.Path)):
ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH,
cafile=str(verify))

connector = aiohttp.TCPConnector(
limit=max_pool_connections,
verify_ssl=self._get_verify_value(verify),
verify_ssl=bool(verify),
ssl_context=ssl_context,
**connector_args)

Expand Down