#215: OpenSSL's SSLSocket appears not to be initialised correctly -------------------------------+-------------------------------------------- Reporter: celtic@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: openssl -------------------------------+-------------------------------------------- When using net/https, the line to create the new SSLSocket in `connect' fails in OpenSSL::SSL::Nonblock, trying to call @io.fcntl and failing since @io==nil. @io should be being set in OpenSSL's ossl_ssl.c:ossl_ssl_initialize; "ossl_ssl_set_io(self, io)"; but this function appears never to be called! (I tried inserting various rb_warns throughout, before finally just sticking in a call to exit() -- it's not being touched) This appears to be the only place where @io is being set. It disturbs me that the C initialiser is not being run - I am not sure if this is a documented issue or not, or if it's even a MacRuby bug (I'm quite new to all this). This problem can be 'fixed' in the meantime by rewriting SSLSocket#initialize in Ruby-land: {{{ def initialize io, ctx=nil ctx = SSLContext.new if ctx.nil? raise "wrong argument (#{ctx.class})! (Expected kind of SSLContext)" if not ctx.kind_of? SSLContext raise "wrong argument (#{io.class})! (Expected kind of IO)" if not io.kind_of? IO @io, @ctx = io, ctx @sync_close = false @ctx.setup super end }}} ossl_ssl_initialize can be removed from ossl_ssl.c after this. Unfortunately, we just run into another bug in ossl_ssl_setup, which has to do with an SSLContext, trying to work out if it's related now. -- Ticket URL: <http://www.macruby.org/trac/ticket/215> MacRuby <http://macruby.org/>