summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-20 15:24:03 +0000
committerzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-20 15:24:03 +0000
commit0f448061dec46ee8c396c772586ea560746dfe5e (patch)
treed2755ff8dd2f79dcebce2d70769ae82ecb911b2c /ext
parent6f553027c52f2e0307576c5901815d414480ff77 (diff)
* ext/openssl/lib/openssl/ssl.rb: [DOC] Document OpenSSL::SSLServer
Based on a patch by Rafal Lisowski [Bug #7348] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/openssl/lib/openssl/ssl.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb
index 741274a5f9..014e1137bc 100644
--- a/ext/openssl/lib/openssl/ssl.rb
+++ b/ext/openssl/lib/openssl/ssl.rb
@@ -148,10 +148,16 @@ module OpenSSL
end
end
+ ##
+ # SSLServer represents a TCP/IP server socket with Secure Sockets Layer.
class SSLServer
include SocketForwarder
+ # When true then #accept works exactly the same as TCPServer#accept
attr_accessor :start_immediately
+ # Creates a new instance of SSLServer.
+ # * +srv+ is an instance of TCPServer.
+ # * +ctx+ is an instance of OpenSSL::SSL::SSLContext.
def initialize(svr, ctx)
@svr = svr
@ctx = ctx
@@ -164,18 +170,22 @@ module OpenSSL
@start_immediately = true
end
+ # Returns the TCPServer passed to the SSLServer when initialized.
def to_io
@svr
end
+ # See TCPServer#listen for details.
def listen(backlog=5)
@svr.listen(backlog)
end
+ # See BasicSocket#shutdown for details.
def shutdown(how=Socket::SHUT_RDWR)
@svr.shutdown(how)
end
+ # Works similar to TCPServer#accept.
def accept
sock = @svr.accept
begin
@@ -189,6 +199,7 @@ module OpenSSL
end
end
+ # See IO#close for details.
def close
@svr.close
end