Issue with autoloading not working on some Rubies
dreilly1982 opened this issue · 1 comments
The autoload in https://github.com/drbrain/net-http-persistent/blob/master/lib/net/http/persistent.rb#L17 seems to fail on some Rubies. While I have not been able to find an root cause of WHY, I do have some examples. This can be seen in rubygems/rubygems-mirror#36 and rubygems/bundler#3107. I have personally seen it on Ruby 2.2.2p95 with the following test:
irb(main):001:0> autoload :OpenSSL, 'openssl'
=> nil
irb(main):002:0> defined? OpenSSL::SSL
=> nil
irb(main):003:0> require 'openssl'
=> true
irb(main):004:0> defined? OpenSSL::SSL
=> "constant"
Where as on other machines (both different versions and 2.2.2p95) it works as intended:
:001 > autoload :OpenSSL, 'openssl'
=> nil
:002 > defined? OpenSSL::SSL
=> "constant"
This is causing programs that rely on this Net::HTTP::Persistent to have to account for this behavior and forcibly load OpenSSL upfront, in much the same way as net/http/pipeline is loaded in https://github.com/drbrain/net-http-persistent/blob/master/lib/net/http/persistent.rb#L12-15
I believe this has been addressed within ruby, if not a new bug should be filed there as the bug will occur with other users of net-http.