From c935b73c29a38eb2410cbfad02fb3220090e4577 Mon Sep 17 00:00:00 2001 From: Jordan Sissel Date: Thu, 3 Jan 2013 15:30:50 -0800 Subject: [PATCH] - Move JRUBY-6970 workarounds into a separate file - Add stripping of "jar:" prefix on OpenSSL ca_path and ca_file settings. (Fixes LOGSTASH-801) --- lib/logstash/JRUBY-6970.rb | 32 ++++++++++++++++++++++++++++++++ lib/logstash/runner.rb | 14 +------------- 2 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 lib/logstash/JRUBY-6970.rb diff --git a/lib/logstash/JRUBY-6970.rb b/lib/logstash/JRUBY-6970.rb new file mode 100644 index 000000000..47501d7a6 --- /dev/null +++ b/lib/logstash/JRUBY-6970.rb @@ -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 diff --git a/lib/logstash/runner.rb b/lib/logstash/runner.rb index c24ae0800..bcc2ecd79 100644 --- a/lib/logstash/runner.rb +++ b/lib/logstash/runner.rb @@ -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