mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Move singleton method to MiniSSL.java
This commit is contained in:
parent
e191003fc4
commit
6a5b30ea30
2 changed files with 18 additions and 7 deletions
|
@ -10,6 +10,7 @@ import org.jruby.RubyString;
|
||||||
|
|
||||||
import org.jruby.anno.JRubyMethod;
|
import org.jruby.anno.JRubyMethod;
|
||||||
|
|
||||||
|
import org.jruby.runtime.Block;
|
||||||
import org.jruby.runtime.ObjectAllocator;
|
import org.jruby.runtime.ObjectAllocator;
|
||||||
import org.jruby.runtime.ThreadContext;
|
import org.jruby.runtime.ThreadContext;
|
||||||
import org.jruby.runtime.builtin.IRubyObject;
|
import org.jruby.runtime.builtin.IRubyObject;
|
||||||
|
@ -60,6 +61,16 @@ public class MiniSSL extends RubyObject {
|
||||||
this.runtime = runtime;
|
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
|
@JRubyMethod
|
||||||
public IRubyObject initialize(IRubyObject key, IRubyObject cert)
|
public IRubyObject initialize(IRubyObject key, IRubyObject cert)
|
||||||
throws java.security.KeyStoreException,
|
throws java.security.KeyStoreException,
|
||||||
|
|
|
@ -83,13 +83,13 @@ module Puma::MiniSSL
|
||||||
VERIFY_NONE = 0
|
VERIFY_NONE = 0
|
||||||
VERIFY_PEER = 1
|
VERIFY_PEER = 1
|
||||||
|
|
||||||
if defined?(JRUBY_VERSION)
|
#if defined?(JRUBY_VERSION)
|
||||||
class Engine
|
#class Engine
|
||||||
def self.server(key, cert)
|
#def self.server(key, cert)
|
||||||
new(key, cert)
|
#new(key, cert)
|
||||||
end
|
#end
|
||||||
end
|
#end
|
||||||
end
|
#end
|
||||||
|
|
||||||
class Server
|
class Server
|
||||||
def initialize(socket, ctx)
|
def initialize(socket, ctx)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue