From: Dagnan on
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?
From: Tanaka Akira on
2010/5/26 Dagnan <dagnan(a)gmail.com>:

> - 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
--
Tanaka Akira

From: Dagnan on
On May 25, 6:06 pm, Tanaka Akira <a...(a)fsij.org> wrote:
> 2010/5/26 Dagnan <dag...(a)gmail.com>:
>
> > - 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
> --
> Tanaka Akira

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.
From: Eric Hodel on
On May 25, 2010, at 09:30, Dagnan wrote:
> On May 25, 6:06 pm, Tanaka Akira <a...(a)fsij.org> wrote:
>> 2010/5/26 Dagnan <dag...(a)gmail.com>:
>>
>>> - 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
>> --
>> Tanaka Akira
>
> 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.

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