Closed jonnyyu closed 2 years ago
I'm not fand of setting ssl=True since it should be an ssl context not a boolean. The ssl kwarg is given to create_connection method which eventually takes a boolean but it will create a ssl_context under the hood which I think we should create as a default.
I don't think the from_url()
is a good API since it does not allow to fine tune the connection
@dzen I changed it to ssl.create_default_context(), please review again. thx!
Any updates on this? @jonnyyu
Hi @NotoriousRebel, I'm still waiting @dzen review my changes. In the meantime, I'm using the following workaround:
ssl = urlparse(uri).scheme == 'amqps'
await aioamqp.from_url(uri, ssl=ssl)
Many thanks this PR, I've taken the libery to rebase it and slightly adapt it to recently merged changes.
from_url() treat amqps as a valid scheme, but it doesn't set ssl argument. This becomes inconvenient when you want to enable SSL via URL parameter.
This PR will check for amqps:// scheme and set ssl argument with default SSL context when ssl argument is not specified explicitly.
Added UT to verify ssl works in both situation.