Issue Type: Bug Bug
Affects Versions: JRuby 1.7.0.pre2
Assignee: Unassigned
Components: OpenSSL, Ruby 1.9.3
Created: 30/Aug/12 11:10 AM
Description:

a gist

This code functions as expected in 1.9.3 but breaks in 1.7-pre2. IO.select says there is data available but read_nonblock raises. The same code without SSL works appropriately.

Unable to find source-code formatter for language: ruby. Available languages are: _javascript_, sql, xhtml, actionscript, none, html, xml, java
require 'socket'
require 'openssl'

host = "127.0.0.1"
port = 9988

ssl_key =  #{path_to_key}
ssl_cert = #{path_to_cert}

ctx = OpenSSL::SSL::SSLContext.new
ctx.key = OpenSSL::PKey::RSA.new File.read(ssl_key)
ctx.cert = OpenSSL::X509::Certificate.new File.read(ssl_cert)
ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE

tcp_server = TCPServer.new(host, port)
@server = OpenSSL::SSL::SSLServer.new(tcp_server, ctx)

t = Thread.new do
  while true
    ios = IO.select [@server]
    ios.first.each do |sock|
      io = sock.accept
      IO.select([io.to_io], nil, nil, 10)
      begin
        data = ""
      rescue OpenSSL::SSL::SSLError => e
        puts e
      end
      puts 'complete'
    end
  end
end

client = TCPSocket.new host, port
sslclient = OpenSSL::SSL::SSLSocket.new(client)
sslclient.connect
sslclient.write "GET / HTTP/1.1\r\nHost: test.com\r\nContent-Type: text/plain\r\n\r\n"

t.join
Environment: jruby 1.7.0.preview2 (1.9.3p203) 2012-08-29 b16f8c3 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_04-b21 [darwin-x86_64]
Project: JRuby
Priority: Major Major
Reporter: Ben Porterfield
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to