[前][次][番号順一覧][スレッド一覧]

ruby-changes:44773

From: shugo <ko1@a...>
Date: Sun, 20 Nov 2016 10:44:12 +0900 (JST)
Subject: [ruby-changes:44773] shugo:r56846 (trunk): shutdown(2) should not be called for SSLSocket.

shugo	2016-11-20 10:44:07 +0900 (Sun, 20 Nov 2016)

  New Revision: 56846

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56846

  Log:
    shutdown(2) should not be called for SSLSocket.
    
    SSLSocket#stop is a private method and cannot be called, but explicit calls
    are not necessary because SSL_shutdown() is called from SSLSocket#close.

  Modified files:
    trunk/lib/net/ftp.rb
Index: lib/net/ftp.rb
===================================================================
--- lib/net/ftp.rb	(revision 56845)
+++ lib/net/ftp.rb	(revision 56846)
@@ -1406,11 +1406,13 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L1406
       end
 
       def shutdown(*args)
-        if @io.respond_to?(:stop)
-          # shut down the TLS connection gracefully.
-          @io.stop
+        if defined?(OpenSSL::SSL::SSLSocket) &&
+            @io.is_a?(OpenSSL::SSL::SSLSocket)
+          # If @io is an SSLSocket, SSL_shutdown() will be called from
+          # SSLSocket#close, so shutdown(2) should not be called.
+        else
+          @io.shutdown(*args)
         end
-        @io.to_io.shutdown(*args)
       end
 
       def read(len = nil)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]