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

Use SSL context for wrapping socket #30

Merged
merged 5 commits into from
Jul 4, 2023

Conversation

sfaiss
Copy link
Contributor

@sfaiss sfaiss commented Jul 3, 2023

This PR adds fine-grained control over the SSL/TLS-settings. It includes the following changes:

  1. SSL sockets behave slightly different than regular sockets in non-blocking mode. They raise SSLWantWriteError / SSLWantReadError instead of BlockingIOError. (see documentation). _tcp_socket_check() handles those exceptions now as well.
  2. As per the documentation, the old wrap_socket() function is deprecated. Instead, a context with secure default settings is created.
  3. If more control is needed, a preconfigured context can be passed to use_secure (instead of the default context when use_secure=True).

Alternative to 3.: Instead of the option to pass a SSL context directly to use_secure, a new optional keyword-argument could be used as well.

This implementation is working on my side, but I still left "untested" in the docstring until someone else can confirm.

@jacobschaer
Copy link
Owner

Can you add a blurb/example to the documentation about how you setup with use_secure since you said you had it working on your setup?

Thanks for adding this.

@sfaiss
Copy link
Contributor Author

sfaiss commented Jul 4, 2023

Sure, no problem. I just added a new section at the bottom of the main page.

@jacobschaer jacobschaer merged commit 364b200 into jacobschaer:main Jul 4, 2023
17 checks passed
@jacobschaer
Copy link
Owner

Merged! Thanks for the help and documentation :)

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.

2 participants