From 4307f96f86f3b77b23f477488b779ee2b74a9d61 Mon Sep 17 00:00:00 2001 From: gotoyuzo Date: Tue, 19 Aug 2003 06:00:36 +0000 Subject: * lib/webrick/ssl.rb: new file; SSL/TLS enhancement for GenericServer. * lib/webrick/https.rb: SSLSocket handling is moved to webrick/ssl.rb. * lib/webrick/compat.rb (File::fnmatch): remove old migration code. * lib/webrick/httpserver.rb (HTTPServer#run): ditto. * lib/webrick/server.rb (GenericServer#listen): the body of this method is pull out as Utils::create_lisnteners. * lib/webrick/utils.rb (Utils::create_lisnteners): new method. * lib/webrick/server.rb (GenericServer#start): should not through unknown errors. and refine comments. * ext/openssl/lib/openssl/ssl.rb (SSLServer#accept): should close socket if SSLSocket raises error. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/openssl/lib/openssl/ssl.rb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'ext/openssl') diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb index 6e6bdfe94..38bf4b748 100644 --- a/ext/openssl/lib/openssl/ssl.rb +++ b/ext/openssl/lib/openssl/ssl.rb @@ -69,11 +69,16 @@ module OpenSSL def accept sock = @svr.accept - ssl = OpenSSL::SSL::SSLSocket.new(sock, @ctx) - ssl.sync = true - ssl.sync_close = true - ssl.accept if @start_immediately - ssl + begin + ssl = OpenSSL::SSL::SSLSocket.new(sock, @ctx) + ssl.sync = true + ssl.sync_close = true + ssl.accept if @start_immediately + ssl + rescue SSLError => ex + sock.close + raise ex + end end def close -- cgit