-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Handle OpenSSL.SSL.WantReadError
and WantWriteError
in pyopenssl adapter
#332
base: main
Are you sure you want to change the base?
Conversation
OpenSSL.SSL.WantReadError
and WantWriteError
in pyopenssl adapter
@vashek have you considered fixing pyopenssl itself? pyca/pyopenssl#176 (comment) |
cheroot/ssl/pyopenssl.py
Outdated
def sendall(self, *args, **kwargs): | ||
"""Send whole message to the socket. | ||
|
||
Not supported due to https://github.com/pyca/pyopenssl/issues/176. | ||
Until that bug is fixed, sendall() may throw SSL.WantWriteError, but | ||
there is no correct way to retry the call because we don't know how | ||
many bytes were already transmitted. We could work around this by | ||
reimplementing sendall() using send(), but we don't actually use | ||
sendall() anywhere. | ||
""" | ||
raise NotImplementedError('sendall() is unsupported by pyOpenSSL') |
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.
How about taking https://github.com/pyca/pyopenssl/blob/124a013/src/OpenSSL/SSL.py#L1649-L1677 and adding retries and then resubmitting the fix to the upstream too?
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.
Another interesting code snippet: Lawouach/WebSocket-for-Python#174 (comment).
cheroot/ssl/pyopenssl.py
Outdated
reimplementing sendall() using send(), but we don't actually use | ||
sendall() anywhere. |
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.
When you say "we don't use" do you mean not even some internal calls hit it? How do we get the error, then?
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.
We don't, as far as I know, it's just something I noticed while googling the WantWriteError issue.
There is no occurrence of sendall
in the whole cheroot project, other than in pyopenssl.py
. (Also, my server seems to work with this change.)
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.
Well, if it's unrelated to the PR, it should be in a separate PR.
Some jobs are failing because of a deprecation warning in cryptography. I've fixed that on |
f4b713b
to
add128a
Compare
Do you think this can be tested somehow? |
@vashek so what do you think about tests? |
The test will probably need to make the sending and/or receiving socket full like I tried here: https://github.com/pyca/pyopenssl/pull/955/files#diff-5fbedfbbf8f0780aeee680927973f302330dc10fe915c7e7deecf4b0556c492cR3157 |
Sorry for letting this rot. Quite honestly, I'd appreciate if someone could help with the tests - or accept it without them. |
Any chance of accepting this? |
e6977b3
to
bab03e9
Compare
@vashek I suppose it's hard to write tests for this which is why I'll probably accept it without tests. But #245 (comment) seems to imply that it may be causing problems for retries. Do you have any thoughts on that? |
bab03e9
to
6fe20d2
Compare
β What kind of change does this PR introduce?
π What is the related issue number (starting with
#
)Fixes #245
β What is the current behavior? (You can also link to an open issue here)
β What is the new behavior (if this is a feature change)?
π Other information:
π Checklist:
and description in grammatically correct, complete sentences
This change isβ