Bug #9750
closedOpenSSL::SSL::SSLServer can not accept a Socket as it's first parameter
Description
This could potentially be an issue with a lack of documentation, in which case this may be more appropriate as a feature request.
The first parameter of OpenSSL::SSL::SSLServer#initialize takes a TCPServer without any issue, however, when provided with an instance of Socket that has been created with Socket::SOCK_STREAM (so a standard TCP socket) it breaks with a "wrong argument type Array (expected File)" when attempting to accept a new client. I tracked this down to the difference in return values from TCPServer#accept (returns just a file descriptor) and Socket#accept (which returns an array of file descriptor and address info) and I believe it would be fairly easy to adjust the SSLServer to be able to handle both.
I've attached some sample standalone code that demonstrates the issue and has a work around based on a subclass'd version of SSLServer that can handle both TCPServer and Socket objects. The important lines are 45-58 as well as 85-86. Everything else is setup and support too get those running or are comments. When running without modification it will demonstrate the error. By swapping the comments on 85-86 you can use the adjusted version of SSLServer#accept.
Please let me know if there are any questions, or concerns. I'm happy to help in anyway around this issue.
Files