diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-14 07:53:32 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-14 07:53:32 +0000 |
commit | dad2382270b8bcfc56a0e2dd73c6201e63ed1a7c (patch) | |
tree | 33b0fdf571109ead0c9bd8d3e90cbd74e8082572 | |
parent | bfcb3fb3be96b8759db9ee441141e373626d782c (diff) | |
download | ruby-dad2382270b8bcfc56a0e2dd73c6201e63ed1a7c.tar.gz |
net/protocol.rb: kwargs
* lib/net/protocol.rb (Net::BufferedIO#initialize): add keyword
arguments for initial attributes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | lib/net/ftp.rb | 3 | ||||
-rw-r--r-- | lib/net/http.rb | 7 | ||||
-rw-r--r-- | lib/net/pop.rb | 6 | ||||
-rw-r--r-- | lib/net/protocol.rb | 10 | ||||
-rw-r--r-- | lib/net/smtp.rb | 6 |
5 files changed, 14 insertions, 18 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index bd89956d36..24895e3fe8 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -446,8 +446,7 @@ module Net if !resp.start_with?("1") raise FTPReplyError, resp end - conn = BufferedSocket.new(sock.accept) - conn.read_timeout = @read_timeout + conn = BufferedSocket.new(sock.accept, read_timeout: @read_timeout) sock.shutdown(Socket::SHUT_WR) rescue nil sock.read rescue nil ensure diff --git a/lib/net/http.rb b/lib/net/http.rb index d68d2c740e..2ada8aba3d 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -925,10 +925,9 @@ module Net #:nodoc: s.sync_close = true D "SSL established" end - @socket = BufferedIO.new(s) - @socket.read_timeout = @read_timeout - @socket.continue_timeout = @continue_timeout - @socket.debug_output = @debug_output + @socket = BufferedIO.new(s, read_timeout: @read_timeout, + continue_timeout: @continue_timeout, + debug_output: @debug_output) if use_ssl? begin if proxy? diff --git a/lib/net/pop.rb b/lib/net/pop.rb index 7f5c09c504..4a2dca2311 100644 --- a/lib/net/pop.rb +++ b/lib/net/pop.rb @@ -555,10 +555,10 @@ module Net s.post_connection_check(@address) end end - @socket = InternetMessageIO.new(s) + @socket = InternetMessageIO.new(s, + read_timeout: @read_timeout, + debug_output: @debug_output) logging "POP session started: #{@address}:#{@port} (#{@apop ? 'APOP' : 'POP'})" - @socket.read_timeout = @read_timeout - @socket.debug_output = @debug_output on_connect @command = POP3Command.new(@socket) if apop? diff --git a/lib/net/protocol.rb b/lib/net/protocol.rb index 6b75b94cda..ca7ef6b8e5 100644 --- a/lib/net/protocol.rb +++ b/lib/net/protocol.rb @@ -79,11 +79,11 @@ module Net # :nodoc: class BufferedIO #:nodoc: internal use only - def initialize(io) + def initialize(io, read_timeout: 60, continue_timeout: nil, debug_output: nil) @io = io - @read_timeout = 60 - @continue_timeout = nil - @debug_output = nil + @read_timeout = read_timeout + @continue_timeout = continue_timeout + @debug_output = debug_output @rbuf = '' end @@ -254,7 +254,7 @@ module Net # :nodoc: class InternetMessageIO < BufferedIO #:nodoc: internal use only - def initialize(io) + def initialize(*) super @wbuf = nil end diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb index ac8ddc5bf2..359a0f9710 100644 --- a/lib/net/smtp.rb +++ b/lib/net/smtp.rb @@ -592,10 +592,8 @@ module Net end def new_internet_message_io(s) - io = InternetMessageIO.new(s) - io.read_timeout = @read_timeout - io.debug_output = @debug_output - io + InternetMessageIO.new(s, read_timeout: @read_timeout, + debug_output: @debug_output) end def do_helo(helo_domain) |