-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Support for non blocking SSL handshake #1059
Comments
Ref: redis/hiredis#1059 Unfortunately I had to patch hiredis to expose wether the handshake was completed or not.
Ref: redis/hiredis#1059 Unfortunately I had to patch hiredis to expose wether the handshake was completed or not.
Ref: redis/hiredis#1059 Unfortunately I had to patch hiredis to expose wether the handshake was completed or not.
Ref: redis/hiredis#1059 Unfortunately I had to patch hiredis to expose wether the handshake was completed or not.
Ref: redis/hiredis#1059 Unfortunately I had to patch hiredis to expose wether the handshake was completed or not.
Ref: redis/hiredis#1059 Unfortunately I had to patch hiredis to expose wether the handshake was completed or not.
Ref: redis/hiredis#1059 Unfortunately I had to patch hiredis to expose wether the handshake was completed or not.
Ref: redis/hiredis#1059 Unfortunately I had to patch hiredis to expose wether the handshake was completed or not.
Ref: redis/hiredis#1059 Unfortunately I had to patch hiredis to expose wether the handshake was completed or not.
Hi, @casperisfine thanks for the report. Your fix looks good, but I'm wondering if there is a way to provide this without exposing the SSL context, as it would put more stringent limitations on the library moving forward. I kind of like that it's encapsulated. @yossigo I'll play around with it but let me know if you have any thoughts. |
@michael-grunder I agree with you that internal structures should not be exposed, can't see why it's really necessary. We do need to remember BTW Looking at the code again, I realize there's something a lot bigger that's still missing: right now, there's no proper handling of |
Yes me too, my "fix" is only meant as a short term hack.
Yes, I think such API would be preferable. However unless I'm mistaken, the caller have to know if it needs to wait for read or for writes (or both), so I believe that information has to be exposed. |
I'm working on a new hiredis binding for Ruby, and I'm running into what seem to be a limitation to handle SSL handshake timeout.
The Ruby binding use
redisConnectNonBlock
so that it can use the Ruby VM APIs to wait on IO and release the GVL (like Python's GIL). This works well for raw TCP or UNIX sockets, but it seems to me that the SSL APis exposed by hiredis are incomplete.My code look like this:
redisInitiateSSLWithContext
does handle non blocking IOs by returning OK:hiredis/ssl.c
Lines 334 to 339 in d7683f3
However if the error was
SSL_ERROR_WANT_READ
orSSL_ERROR_WANT_WRITE
, the caller is expected to callSSL_connect
again:The problem is that the reference to the
SSL
pointer is entirely hidden, and that callingredisInitiateSSLWithContext
again would return an error because it's not meant to be repeated.I feel like it's missing a small API to retry the
SSL_connect
call after waiting onselect(2)
.cc @michael-grunder
The text was updated successfully, but these errors were encountered: