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

Add sslmode=allow support and fix =prefer retry #720

Merged
merged 2 commits into from
Mar 24, 2021

Conversation

fantix
Copy link
Member

@fantix fantix commented Mar 22, 2021

We didn't really retry the connection without SSL if the first SSL connection fails under sslmode=prefer, that led to an issue when the server has SSL support but explicitly denies SSL connection through pg_hba.conf. This commit adds a retry in a new connection, which makes it easy to implement the sslmode=allow retry.

Fixes #716

asyncpg allow_prefer

@fantix fantix marked this pull request as ready for review March 22, 2021 03:45
@fantix fantix requested a review from elprans March 22, 2021 03:56
@fantix fantix force-pushed the t716-sslmode-allow branch 7 times, most recently from 7ee46eb to f38aa70 Compare March 24, 2021 02:50
asyncpg/connect_utils.py Outdated Show resolved Hide resolved
We didn't really retry the connection without SSL if the first SSL
connection fails under sslmode=prefer, that led to an issue when the
server has SSL support but explicitly denies SSL connection through
pg_hba.conf. This commit adds a retry in a new connection, which
makes it easy to implement the sslmode=allow retry.

Fixes MagicStack#716
@fantix fantix merged commit 075114c into MagicStack:master Mar 24, 2021
@fantix fantix deleted the t716-sslmode-allow branch March 24, 2021 03:40
@elprans elprans mentioned this pull request May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SSL 'prefer' option in asyncpg behaves different than libpq
2 participants