-
Notifications
You must be signed in to change notification settings - Fork 3
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
Notes while reading #2
Comments
A few more thoughts:
|
No, because wrapped sockets.
Yeah, the answer is "maybe". But the reasoning for it is simple: to reduce the number of places that have to buffer. That may be unnecessary, in the end, of course. |
Oh, sure. But maybe we should drop it from the set of allowable exceptions raised by the abstract sans-IO interface. |
@njsmith BTW, where there are things that are underspecified it'd be super-useful to see a PR that would better specify them. I'm acutely aware that I've basically written all of this document by myself, which means it's seen a substantial lack of coverage in areas that aren't popping up in my mind. (Also, if we rely on me doing all of this it'll take ages to get done. ;) ) |
Where would such a PR go? directly against the peps repository? |
Hrm, yeah, good point. I have an in-progress copy of the PEP somewhere: I'll add it to this repo. |
Ok I've brought in an updated copy of PEP 543. Feel free to make PRs against it. |
Not sure this is the most useful way to record these, but I figure it's better than my just thinking them to myself and then forgetting about them :-). Let me know if they should be moved to some other repo or mailing list or something.
IMO the SNI callback should receive the hostname as a bytes object containing the A-label version of the hostname, which for the stdlib wrapper means there should be a call to
.encode("idna")
inpep543_callback
.OpenSSL has an annoying thing where when you set a new context from the SNI callback, it only updates some parts of its internal configuration from that context, while ignoring others. Possibly the PEP 543 wrapper callback should work around this by noticing when these other things have changed and updating them manually, if it can, and otherwise error out. (ref)
We need at least two kinds of
TLSError
: one that means "definitely an error", and one that means "definitely an error, unless you're running in HTTP-compatibility mode, in which case pretend it's a clean EOF". (For the stdlib wrapper,SSLEOFError
should give you the first one, and everything else the second one.) [Edit: I see that PEP 543 says that'sRaggedEOF
; so then the note here is that_error_converter
needs to doSSLEOFError
→RaggedEOF
.]I'm pretty sure the stdlib never raises
SSLZeroReturnError
. Though I can't prove it. But it certainly tries to convert it into areturn b""
internally.Writing to a
ssl.MemoryBIO
definitely never returns short. The API allows for the possibility because it might happen for other BIOs, but MemoryBIOs in particular will grow to whatever size they need to, so the nervous comment inreceive_from_network
is unnecessary.You do need to watch out though that
MemoryBIO.write(b"")
"helpfully" gets interpreted as indicating an EOF, which may or may not match your API convention forreceive_from_network
.Speaking of unbounded memory buffers, it's also impossible to get an
SSLWantWriteError
. I think we should consider removing it from the PEP 543 abstract API.You might want to enforce that
do_handshake
is called given https://bugs.python.org/issue30141The text was updated successfully, but these errors were encountered: