# Problem with https connection in Ruby 1.8.4

**URL:** <https://www.ruby-forum.com/t/problem-with-https-connection-in-ruby-1-8-4/102068>\
**Category:** Ruby\
**Created:** [February 7, 2006, 6:50pm UTC](https://www.ruby-forum.com/t/problem-with-https-connection-in-ruby-1-8-4/102068 "2006-02-07T18:50:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![toadkicker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/5fc32e/32.png) [@toadkicker](https://www.ruby-forum.com/u/toadkicker)\
**Post date:** [February 7, 2006, 6:50pm UTC](https://www.ruby-forum.com/t/problem-with-https-connection-in-ruby-1-8-4/102068/1 "2006-02-07T18:50:50Z")

</div>

I’m getting the following error when executing in Ruby 1.8.4 (tried it  
both on Windows and OS X). I did not see this problem in 1.8.2.

Here is the code:

```
def init_server(url)
  @url = URI.parse(url)
  @server = Net::HTTP.new(@url.host, @url.port)
  @server.use_ssl = @url.scheme == 'https'
  @server.verify_mode = OpenSSL::SSL::VERIFY_NONE

  # run ruby with -d to see SOAP wiredumps.
  @server.set_debug_output $stderr if show_debug
end

```

And here is the error:

NoMethodError: You have a nil object when you didn’t expect it!  
The error occured while evaluating nil.verify\_mode  
from e:/ruby/lib/ruby/1.8/net/http.rb:565:in `connect' from e:/ruby/lib/ruby/1.8/net/http.rb:555:in `do\_start’  
from e:/ruby/lib/ruby/1.8/net/http.rb:544:in `start' from e:/ruby/lib/ruby/1.8/net/http.rb:1031:in `request’  
from e:/ruby/lib/ruby/1.8/net/http.rb:988:in `post2' from e:/ruby/lib/ruby/gems/1.8/gems/activesalesforce-0.2.2/lib/rforce.rb:230:in `call\_remote’  
from  
e:/ruby/lib/ruby/gems/1.8/gems/activesalesforce-0.2.2/lib/rforce.rb:185:in  
`login' from e:/ruby/lib/ruby/gems/1.8/gems/activesalesforce-0.2.2/lib/salesforce_connection_adapter.rb:72:in `activesalesforce\_connection’  
from  
e:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/connection\_adapters/abstract/connection\_specification.rb:145:in  
`connection_without_query_cache=' from e:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/query_cache.rb:54:in `connection=’  
from  
e:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/connection\_adapters/abstract/connection\_specification.rb:106:in  
`retrieve_connection' from e:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:20:in `connection’  
from  
e:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/base.rb:931:in  
`add_limit!' from e:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:924:in `construct\_finder\_sql’  
from  
e:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/base.rb:395:in  
`find’

I found a reference to the same problem on a Debian bug list  
([http://www.mail-archive.com/removed\_email\_address@domain.invalid/msg149314.html](http://www.mail-archive.com/removed_email_address@domain.invalid/msg149314.html))  
but no resolution.

Did something change between 1.8.2 and 1.8.4 in regards to handling  
HTTPS connections?

Thanks!

Todd B.

---

<div class="post-metadata">

**Author:** ![toadkicker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/5fc32e/32.png) [@toadkicker](https://www.ruby-forum.com/u/toadkicker)\
**Post date:** [February 7, 2006, 10:37pm UTC](https://www.ruby-forum.com/t/problem-with-https-connection-in-ruby-1-8-4/102068/2 "2006-02-07T22:37:13Z")

</div>

On Feb 7, 2006, at 9:49 AM, Todd B. wrote:

> ```
> # run ruby with -d to see SOAP wiredumps.
> @server.set_debug_output $stderr if show_debug
> end
> 
> ```
> 
> And here is the error:
> 
> NoMethodError: You have a nil object when you didn’t expect it!  
> The error occured while evaluating nil.verify\_mode

You should first verify that Rails isn’t interfering. Try this script:

$ cat ssl.rb  
require ‘net/https’

url = URI.parse ‘[https://www.wamu.com](https://www.wamu.com)’  
server = Net::HTTP.new url.host, url.port  
server.use\_ssl = url.scheme == ‘https’  
server.verify\_mode = OpenSSL::SSL::VERIFY\_NONE  
response = server.get url.request\_uri  
puts response.code

$ ruby -v ssl.rb  
ruby 1.8.4 (2005-12-24) [powerpc-darwin8.4.0]  
/usr/local/lib/ruby/1.8/net/http.rb:569: warning: using default DH  
parameters.  
302

–  
Eric H. - removed\_email\_address@domain.invalid - [http://segment7.net](http://segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)

---

<div class="post-metadata">

**Author:** ![toadkicker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/5fc32e/32.png) [@toadkicker](https://www.ruby-forum.com/u/toadkicker)\
**Post date:** [February 7, 2006, 11:13pm UTC](https://www.ruby-forum.com/t/problem-with-https-connection-in-ruby-1-8-4/102068/3 "2006-02-07T23:13:49Z")

</div>

Eric

Thanks for the reply. I tried your script on Windows and got the same  
error. I’ll try it on my Powerbook when I get home.

ruby 1.8.4 (2005-12-24) [i386-mswin32]  
e:/ruby/lib/ruby/site\_ruby/1.8/net/https.rb:121: warning: method  
redefined; discarding old edit\_path  
e:/ruby/lib/ruby/site\_ruby/1.8/net/https.rb:130: warning: redefine  
socket\_type  
e:/ruby/lib/ruby/site\_ruby/1.8/net/https.rb:157: warning: method  
redefined; discarding old on\_connect  
e:/ruby/lib/ruby/1.8/net/http.rb:565:in `connect': undefined method`verify\_mode’ for nil:NilClass (NoMethodError)  
from e:/ruby/lib/ruby/1.8/net/http.rb:555:in `do_start' from e:/ruby/lib/ruby/1.8/net/http.rb:544:in`start’  
from e:/ruby/lib/ruby/1.8/net/http.rb:1031:in `request' from e:/ruby/lib/ruby/1.8/net/http.rb:771:in`get’  
from ssl.rb:7

Todd B.

---

<div class="post-metadata">

**Author:** ![toadkicker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/5fc32e/32.png) [@toadkicker](https://www.ruby-forum.com/u/toadkicker)\
**Post date:** [April 1, 2006, 9:20am UTC](https://www.ruby-forum.com/t/problem-with-https-connection-in-ruby-1-8-4/102068/4 "2006-04-01T09:20:55Z")

</div>

I have solved the problem for myself.

I had installed 1.8.4 on top of 1.8.2 and since some of the libraries  
have moved locations I suspect the old versions were still around and  
messing things up.

I did a clean install of 1.8.4 and everything was fine.

Thanks to Aoki san who kindly helped me with some debugging.

Robert

---

<div class="post-metadata">

**Author:** ![toadkicker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/5fc32e/32.png) [@toadkicker](https://www.ruby-forum.com/u/toadkicker)\
**Post date:** [April 5, 2006, 11:31pm UTC](https://www.ruby-forum.com/t/problem-with-https-connection-in-ruby-1-8-4/102068/5 "2006-04-05T23:31:19Z")

</div>

I just re-encountered this problem and it turns out I had an old  
version of https.rb in my site\_ruby directory. I cleaned that up and  
everything is working fine now.

Todd

---

<div class="post-metadata">

**Author:** ![toadkicker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/5fc32e/32.png) [@toadkicker](https://www.ruby-forum.com/u/toadkicker)\
**Post date:** [March 29, 2006, 11:12pm UTC](https://www.ruby-forum.com/t/problem-with-https-connection-in-ruby-1-8-4/102068/6 "2006-03-29T23:12:10Z")

</div>

Todd B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote in  
news:removed\_email\_address@domain.invalid:

> I’m getting the following error when executing in Ruby 1.8.4 (tried it  
> both on Windows and OS X). I did not see this problem in 1.8.2.

\<snip

> ```
> from
> e:/ruby/lib/ruby/gems/1.8/gems/activesalesforce-0.2.2/lib/rforc
> e.rb:230:in 
> 
> ```
> 
> `call\_remote’  
> from  
> e:/ruby/lib/ruby/gems/1.8/gems/activesalesforce-

Did you find the problem?

I have had exactly the same - my script worked under 1.8.2 - upgrade to  
1.8.4 and boom!

Robert
