tenderlove/mechanize — Issue #207: NameError: uninitialized constant OpenSSL::SSL::Session with jruby
Author: jhund
Created: 2012-02-22 05:19:56+00:00
State: open

When using mechanize to fetch the following https URL, I get the error listed in the title:

```ruby
agent = Mechanize.new
agent.redirect_ok = :all
agent.follow_meta_refresh = true
agent.user_agent = "My user agent"
agent.keep_alive = false
agent.open_timeout = 20
agent.read_timeout = 20

agent.get("https://plus.google.com/u/0/111091089527727420853/posts/QSraHjCsFZk")
=> NameError: uninitialized constant OpenSSL::SSL::Session
```

I'm not sure if this is related to net-http-persistent-2.5.2 or to jruby-openssl ? If so, let me know and I'll repost there.

My environment:

* jruby 1.6.3 (1.8 mode)
* OS X
* Rails 3.0.9
* Mechanize: master as of Feb 19, 2012 (shortly after 2.2.1). I used master to work around issue #203
* jruby-openssl 0.7.6.1

Some additional notes:

* I found this ticket on the jruby issue tracker: "Implement OpenSSL::SSL::Session object" (http://jira.codehaus.org/browse/JRUBY-4371)
* I have made sure that Certificate verification works on my dev system. The snippet below works fine:

``` ruby
uri = URI.parse("https://plus.google.com/u/0/111091089527727420853/posts/QSraHjCsFZk")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
http.request_get(uri.path)
=> #
```

Sorry that this is not as detailed as I'd like it to be. I'm still trying to figure out where I should report this. Since it became visible after I upgraded Mechanize from 2.0.1 to 2.2.1, I'm starting here, ready to move on to underlying libraries as required.

Thanks for any pointers you can give me.

Cheers

Jo