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 Breiholz

On 2/7/06, Eric Hodel <drbrain / segment7.net> wrote:
> On Feb 7, 2006, at 9:49 AM, Todd Breiholz wrote:
>
> > 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
>
> 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'
> 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 Hodel - drbrain / segment7.net - http://segment7.net
> This implementation is HODEL-HASH-9600 compliant
>
> http://trackmap.robotcoop.com
>
>
>
>