Created
December 2, 2011 23:25
-
-
Save dalyons/1425320 to your computer and use it in GitHub Desktop.
openssl hax needed to get a fairly standard rails3.1 app going on JRuby 1.6.x
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if defined?(JRUBY_VERSION) | |
#Hackily implement a missing method in JRuby net library that causes: | |
# undefined method `read_nonblock' for #<OpenSSL::SSL::SSLSocket:0xb692bc4> | |
# | |
#See: http://jira.codehaus.org/browse/JRUBY-5529 | |
# | |
#In my case, its trigger from faraday in the oauth2 gem. | |
Net::BufferedIO.class_eval do | |
BUFSIZE = 1024 * 16 | |
def rbuf_fill | |
timeout(@read_timeout) { | |
@rbuf << @io.sysread(BUFSIZE) | |
} | |
end | |
end | |
#Disable ssl verification, otherwise we get | |
# OpenSSL::SSL::SSLError | |
# certificate verify failed | |
# when we try to connect to a https site. | |
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment