-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Separate SSLSocket from Socket #4049
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skimmed it and only see one thing to change. Thanks for following up with this!
It should also go without saying that this PR breaks the heck out of requests |
Why? It shouldn't because this is the same API as CPython which requests works with. |
Yes, sorry, you're right. There was an error in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me! Thank you for separating these out!
This PR removes the TLS implementations from Socket and moves them to a new object class, SSLSocket, which is created from a Socket object using SSL's
contex.wrap_socket()
function. This behavior more closely matches that of Cpython.Opening as a draft as I've had a couple difficulties with this change and I'm still testing:
connect
, but I've had issues making this non-blocking. A non-blocking call toconnect
should always return a -1 "EINPROGRESS" error for the first call, but I don't find that they ever connect, no matter how long the timeout is. The current implementation simply switches the entire socket to blocking mode briefly, but other failed implementations are shown as comments.bind
andlisten
andaccept
- as best I can tell, they should call the original functions (ie LWIP ones) and then just wrap whatever socket gets accepted as a SSLSocket. But I'm still not sure about this.Also includes bugfixes for a variety of user-reported issues with Socket.
Resolves #4057
Resolves #4101