class OpenSSL::SSL::SSLServer
SSLServer repräsentiert einen TCP/IP-Server-Socket mit Secure Sockets Layer.
Attribute
Wenn true, funktioniert accept genau wie TCPServer#accept
Öffentliche Klassenmethoden
Source
# File ext/openssl/lib/openssl/ssl.rb, line 486 def initialize(svr, ctx) @svr = svr @ctx = ctx unless ctx.session_id_context # see #6137 - session id may not exceed 32 bytes prng = ::Random.new($0.hash) session_id = prng.bytes(16).unpack1('H*') @ctx.session_id_context = session_id end @start_immediately = true end
Erstellt eine neue Instanz von SSLServer.
-
srv ist eine Instanz von
TCPServer. -
ctx ist eine Instanz von
OpenSSL::SSL::SSLContext.
Öffentliche Instanzmethoden
Source
# File ext/openssl/lib/openssl/ssl.rb, line 514 def accept # Socket#accept returns [socket, addrinfo]. # TCPServer#accept returns a socket. # The following comma strips addrinfo. sock, = @svr.accept begin ssl = OpenSSL::SSL::SSLSocket.new(sock, @ctx) ssl.sync_close = true ssl.accept if @start_immediately ssl rescue Exception => ex if ssl ssl.close else sock.close end raise ex end end
Funktioniert ähnlich wie TCPServer#accept.
Source
# File ext/openssl/lib/openssl/ssl.rb, line 535 def close @svr.close end
Weitere Details finden Sie unter IO#close.
Source
# File ext/openssl/lib/openssl/ssl.rb, line 504 def listen(backlog=Socket::SOMAXCONN) @svr.listen(backlog) end
Weitere Details finden Sie unter TCPServer#listen.
Source
# File ext/openssl/lib/openssl/ssl.rb, line 509 def shutdown(how=Socket::SHUT_RDWR) @svr.shutdown(how) end
Weitere Details finden Sie unter BasicSocket#shutdown.