Problem with Ruby 1.9, HTTPS and OpenSSL

D

Dagnan

Hi

I have a strange problem with my Ruby installation.

First:
- I use RVM, and I tried to compile Ruby with my system version of
openssl (and libs), and with the package version included in RVM. Both
fail
- I have never had an error during compilation/installation, always at
runtime
- I don't use a firewall and the page is displayed fine in my browser
- with my system install of Ruby (1.8.7) I don't have this problem...

I use this simple script

*************************
require 'net/http'
require 'net/https'
require 'uri'

url = URI.parse('https://www.google.com')
res = Net::HTTP.start(url.host, url.port) { |http|
http.get('/')
}
puts res.body
*************************

and I get

~/.rvm/rubies/ruby-1.9.2-preview1/lib/ruby/1.9.1/net/protocol.rb:
135:in `read_nonblock': end of file reached (EOFError)
from /~/.rvm/rubies/ruby-1.9.2-preview1/lib/ruby/1.9.1/net/
protocol.rb:135:in `rbuf_fill'
from /~/.rvm/rubies/ruby-1.9.2-preview1/lib/ruby/1.9.1/net/
protocol.rb:116:in `readuntil'
from /~/.rvm/rubies/ruby-1.9.2-preview1/lib/ruby/1.9.1/net/
protocol.rb:126:in `readline'
from /~/.rvm/rubies/ruby-1.9.2-preview1/lib/ruby/1.9.1/net/
http.rb:2138:in `read_status_line'
from /~/.rvm/rubies/ruby-1.9.2-preview1/lib/ruby/1.9.1/net/
http.rb:2127:in `read_new'
from /~/.rvm/rubies/ruby-1.9.2-preview1/lib/ruby/1.9.1/net/
http.rb:1120:in `transport_request'
from /~/.rvm/rubies/ruby-1.9.2-preview1/lib/ruby/1.9.1/net/
http.rb:1106:in `request'
from /~/.rvm/rubies/ruby-1.9.2-preview1/lib/ruby/1.9.1/net/
http.rb:817:in `get'
from testhttp.rb:6:in `block in <main>'
from /~/.rvm/rubies/ruby-1.9.2-preview1/lib/ruby/1.9.1/net/
http.rb:564:in `start'
from /~/.rvm/rubies/ruby-1.9.2-preview1/lib/ruby/1.9.1/net/
http.rb:453:in `start'
from testhttp.rb:6:in `<main>'

What do you think is the source of the problem?
 
T

Tanaka Akira

2010/5/26 Dagnan said:
- with my system install of Ruby (1.8.7) I don't have this problem...

Strange. Ruby 1.8.7p248 raises EOFError on my environment.

% ruby-1.8.7p248 -ve "
require 'net/http'
require 'net/https'
require 'uri'

url = URI.parse('https://www.google.com')
res = Net::HTTP.start(url.host, url.port) { |http|
http.get('/')
}
"
ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-linux]
/home/ruby/187p248/lib/ruby/1.8/net/protocol.rb:135:in `sysread': end
of file reached (EOFError)
from /home/ruby/187p248/lib/ruby/1.8/net/protocol.rb:135:in `rbuf_fill'
from /home/ruby/187p248/lib/ruby/1.8/timeout.rb:62:in `timeout'
from /home/ruby/187p248/lib/ruby/1.8/timeout.rb:93:in `timeout'
from /home/ruby/187p248/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
from /home/ruby/187p248/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
from /home/ruby/187p248/lib/ruby/1.8/net/protocol.rb:126:in `readline'
from /home/ruby/187p248/lib/ruby/1.8/net/http.rb:2024:in
`read_status_line'
from /home/ruby/187p248/lib/ruby/1.8/net/http.rb:2013:in `read_new'
from /home/ruby/187p248/lib/ruby/1.8/net/http.rb:1050:in `request'
from /home/ruby/187p248/lib/ruby/1.8/net/http.rb:772:in `get'
from -e:8
from /home/ruby/187p248/lib/ruby/1.8/net/http.rb:543:in `start'
from /home/ruby/187p248/lib/ruby/1.8/net/http.rb:440:in `start'
from -e:7
 
D

Dagnan

2010/5/26 Dagnan said:
- with my system install of Ruby (1.8.7) I don't have this problem...

Strange.  Ruby 1.8.7p248 raises EOFError on my environment.

% ruby-1.8.7p248 -ve "
require 'net/http'
require 'net/https'
require 'uri'

url = URI.parse('https://www.google.com')
res = Net::HTTP.start(url.host, url.port) { |http|
   http.get('/')}

"
ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-linux]
/home/ruby/187p248/lib/ruby/1.8/net/protocol.rb:135:in `sysread': end
of file reached (EOFError)
        from /home/ruby/187p248/lib/ruby/1.8/net/protocol.rb:135:in `rbuf_fill'
        from /home/ruby/187p248/lib/ruby/1.8/timeout.rb:62:in `timeout'
        from /home/ruby/187p248/lib/ruby/1.8/timeout.rb:93:in `timeout'
        from /home/ruby/187p248/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
        from /home/ruby/187p248/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
        from /home/ruby/187p248/lib/ruby/1.8/net/protocol.rb:126:in `readline'
        from /home/ruby/187p248/lib/ruby/1.8/net/http.rb:2024:in
`read_status_line'
        from /home/ruby/187p248/lib/ruby/1.8/net/http.rb:2013:in `read_new'
        from /home/ruby/187p248/lib/ruby/1.8/net/http.rb:1050:in `request'
        from /home/ruby/187p248/lib/ruby/1.8/net/http.rb:772:in `get'
        from -e:8
        from /home/ruby/187p248/lib/ruby/1.8/net/http.rb:543:in `start'
        from /home/ruby/187p248/lib/ruby/1.8/net/http.rb:440:in `start'
        from -e:7

My mistake. It fails everywhere, because with net/https we have to
specify to use ssl.

My problem is actually in net-http-persistent module, I try to
reproduce it but it succeeds manually...

So this topic is no longer useful.
 
E

Eric Hodel

2010/5/26 Dagnan said:
- with my system install of Ruby (1.8.7) I don't have this =
problem...
=20
Strange. Ruby 1.8.7p248 raises EOFError on my environment.
=20
% ruby-1.8.7p248 -ve "
require 'net/http'
require 'net/https'
require 'uri'
=20
url =3D URI.parse('https://www.google.com')
res =3D Net::HTTP.start(url.host, url.port) { |http|
http.get('/')}
=20
"
ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-linux]
/home/ruby/187p248/lib/ruby/1.8/net/protocol.rb:135:in `sysread': end
of file reached (EOFError)
from /home/ruby/187p248/lib/ruby/1.8/net/protocol.rb:135:in = `rbuf_fill'
from /home/ruby/187p248/lib/ruby/1.8/timeout.rb:62:in = `timeout'
from /home/ruby/187p248/lib/ruby/1.8/timeout.rb:93:in = `timeout'
from /home/ruby/187p248/lib/ruby/1.8/net/protocol.rb:134:in = `rbuf_fill'
from /home/ruby/187p248/lib/ruby/1.8/net/protocol.rb:116:in = `readuntil'
from /home/ruby/187p248/lib/ruby/1.8/net/protocol.rb:126:in = `readline'
from /home/ruby/187p248/lib/ruby/1.8/net/http.rb:2024:in
`read_status_line'
from /home/ruby/187p248/lib/ruby/1.8/net/http.rb:2013:in = `read_new'
from /home/ruby/187p248/lib/ruby/1.8/net/http.rb:1050:in = `request'
from /home/ruby/187p248/lib/ruby/1.8/net/http.rb:772:in `get'
from -e:8
from /home/ruby/187p248/lib/ruby/1.8/net/http.rb:543:in = `start'
from /home/ruby/187p248/lib/ruby/1.8/net/http.rb:440:in = `start'
from -e:7
=20
My mistake. It fails everywhere, because with net/https we have to
specify to use ssl.
=20
My problem is actually in net-http-persistent module, I try to
reproduce it but it succeeds manually...
=20
So this topic is no longer useful.

There was a bug in net-http-persistent. Upgrade to net-http-persistent =
1.2.1=
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top