- Move JRUBY-6970 workarounds into a separate file

- Add stripping of "jar:" prefix on OpenSSL ca_path and ca_file
  settings. (Fixes LOGSTASH-801)
This commit is contained in:
Jordan Sissel 2013-01-03 15:30:50 -08:00
parent 47a8ace6a9
commit c935b73c29
2 changed files with 33 additions and 13 deletions

View file

@ -0,0 +1,32 @@
# Monkeypatch for JRUBY-6970
module Kernel
alias_method :require_JRUBY_6970_hack, :require
def require(path)
if path =~ /^jar:file:.+!.+/
path = path.gsub(/^jar:/, "")
puts "JRUBY-6970: require(#{path})" if ENV["REQUIRE_DEBUG"] == "1"
end
return require_JRUBY_6970_hack(path)
end
end
require "openssl"
class OpenSSL::SSL::SSLContext
alias_method :ca_path_JRUBY_6970=, :ca_path=
alias_method :ca_file_JRUBY_6970=, :ca_file=
def ca_file=(arg)
if arg =~ /^jar:file:\//
return ca_file_JRUBY_6970=(arg.gsub(/^jar:/, ""))
end
return ca_file_JRUBY_6970=(arg)
end
def ca_path=(arg)
if arg =~ /^jar:file:\//
return ca_path_JRUBY_6970=(arg.gsub(/^jar:/, ""))
end
return ca_path_JRUBY_6970=(arg)
end
end

View file

@ -1,20 +1,8 @@
# Monkeypatch for JRUBY-6970
module Kernel
alias_method :require_JRUBY_6970_hack, :require
def require(path)
if path =~ /^jar:file:.+!.+/
path = path.gsub(/^jar:/, "")
puts "JRUBY-6970: require(#{path})" if ENV["REQUIRE_DEBUG"] == "1"
end
return require_JRUBY_6970_hack(path)
end
end
require "rubygems"
require "logstash/namespace"
require "logstash/program"
require "logstash/util"
require "logstash/JRUBY-6970"
if ENV["PROFILE_BAD_LOG_CALLS"]
# Set PROFILE_BAD_LOG_CALLS=1 in your environment if you want