mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Disconnect immediately even if Net::FTP#close is called without quit.
In that case, BufferedSSLSocket#read in FTP#close exceeded timeout because BufferedSSLSocket#shutdown did nothing. So BufferedIO#rbuf_fill is overridden in BufferedSSLSocket to raise an EOFError if the connection is shut down. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e50266f299
commit
a7a1391fc9
1 changed files with 16 additions and 0 deletions
|
@ -1443,16 +1443,32 @@ module Net
|
|||
|
||||
if defined?(OpenSSL::SSL::SSLSocket)
|
||||
class BufferedSSLSocket < BufferedSocket
|
||||
def initialize(*args)
|
||||
super
|
||||
@is_shutdown = false
|
||||
end
|
||||
|
||||
def shutdown(*args)
|
||||
# SSL_shutdown() will be called from SSLSocket#close, and
|
||||
# SSL_shutdonw() will send the "close notify" alert to the peer,
|
||||
# so shutdown(2) should not be called.
|
||||
@is_shutdown = true
|
||||
end
|
||||
|
||||
def send(mesg, flags, dest = nil)
|
||||
# Ignore flags and dest.
|
||||
@io.write(mesg)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def rbuf_fill
|
||||
if @is_shutdown
|
||||
raise EOFError, "shutdown has been called"
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
# :startdoc:
|
||||
|
|
Loading…
Add table
Reference in a new issue