diff --git a/ext/puma_http11/org/jruby/puma/MiniSSL.java b/ext/puma_http11/org/jruby/puma/MiniSSL.java index 24c6cecf..e4bf8461 100644 --- a/ext/puma_http11/org/jruby/puma/MiniSSL.java +++ b/ext/puma_http11/org/jruby/puma/MiniSSL.java @@ -10,6 +10,7 @@ import org.jruby.RubyString; import org.jruby.anno.JRubyMethod; +import org.jruby.runtime.Block; import org.jruby.runtime.ObjectAllocator; import org.jruby.runtime.ThreadContext; import org.jruby.runtime.builtin.IRubyObject; @@ -60,6 +61,16 @@ public class MiniSSL extends RubyObject { this.runtime = runtime; } + @JRubyMethod(meta = true) + public static IRubyObject server(ThreadContext context, IRubyObject recv, IRubyObject key, IRubyObject cert) { + RubyClass klass = (RubyClass) recv; + IRubyObject newInstance = klass.newInstance(context, + new IRubyObject[] { key, cert }, + Block.NULL_BLOCK); + + return newInstance; + } + @JRubyMethod public IRubyObject initialize(IRubyObject key, IRubyObject cert) throws java.security.KeyStoreException, diff --git a/lib/puma/minissl.rb b/lib/puma/minissl.rb index 2ad8832f..911c028e 100644 --- a/lib/puma/minissl.rb +++ b/lib/puma/minissl.rb @@ -83,13 +83,13 @@ module Puma::MiniSSL VERIFY_NONE = 0 VERIFY_PEER = 1 - if defined?(JRUBY_VERSION) - class Engine - def self.server(key, cert) - new(key, cert) - end - end - end + #if defined?(JRUBY_VERSION) + #class Engine + #def self.server(key, cert) + #new(key, cert) + #end + #end + #end class Server def initialize(socket, ctx)