summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2016-11-29get rid of ambiguous parentheses warningsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-29get rid of test failures on CI introduced at r56927usa
* lib/matrix.rb: now ruby warns ambiguous parentheses after a space in method definitions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-29Suppress warnings.shugo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-29net/ftp: add a new option ssl_handshake_timeout to Net::FTP.new.shugo
The TLS handshake timeout can be specified independently, because the TLS handshake doesn't start just after the underlying connection is established, but after the AUTH command is completed. It's also useful for testing purposes. However, if ssl_handshake_timeout is not specified, open_timeout is used instead for convenience. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-29net/ftp: close the socket directly when an error occurs during TLS handshake.shugo
Otherwise, @sock.read in Net::FTP#close hungs until read_timeout exceeded. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-29net/ftp: close the connection if the TLS handshake timeout is exceeded.shugo
Otherwise, file descriptor leaks may occur in Net::FTP.new. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-26net/ftp: support timeout for TLS handshake.shugo
Net::FTP inherits ssl_socket_connect from Net::Protocol to implement timeout. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-23resolv: use safe navigation operator to avoid extra hash lookupsnormal
@addr2name is a private Hash and never changes its default_proc, so only pay the hash lookup cost once; we know missing entries in the hash will be nil. * lib/resolv.rb (each_name): use safe navigation operator git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-23webrick/server: use symbol procnormal
Symbol proc is less code and avoids confusion from variable naming. * lib/webrick/server.rb (shutdown): use symbol proc git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-23Add CR/LF check to Net::FTP#status.shugo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-23lib/net/ftp: fix typonormal
* lib/net/ftp.rb (shutdown): fix typo git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-23Disconnect immediately even if Net::FTP#close is called without quit.shugo
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
2016-11-23Add a new optinal argument pathname to FTP#stat.shugo
Based on the patch by soleboxy. [Fix GH-1478] [ruby-core:78240] [Feature #12965] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-22Use `&.` instead of `if` and `? :`kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-22Use `&.` and `||=` instead of if guardsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-22IOError does not happenkazu
* IOError does not happen even if another thread closes io * Use symbol proc git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-22Use `&.` instead of modifier ifkazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-22Add BufferedSSLSocket#send.shugo
SSLSocket#send is not defined, so use #write instead. flags and dest are ignored. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-22webrick/server: simplify Daemon.startnormal
Process.daemon exists since Ruby 1.9.1 and does most of what we need. * lib/webrick/server.rb (Daemon.start): simplify [Misc #12937] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-21resolv: use symbol proc when possiblenormal
This reduces both human code and bytecode. lib/resolv.rb (sender_for, Config.parse_resolv_conf): use symbol proc git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-21lib/open3: favor symbol proc when possiblenormal
It reduces both human and machine code; as well as reducing the confusion from variable naming. * lib/open3.rb (popen_run, pipeline, pipeline_run): avoid capture git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-21lib/*: remove closed checksnormal
Follow r56795. Since Ruby 2.2, calling #close on a closed socket no longer raises exceptions. * lib/cgi/session.rb (update): remove closed? check * lib/net/http.rb (finish, transport_request): ditto * lib/net/imap.rb (disconnect): ditto * lib/net/pop.rb (do_start, do_finish): ditto * lib/net/smtp.rb (do_start, do_finish): ditto * lib/open3.rb (popen_run, pipeline_run): ditto * lib/pstore.rb (transaction): ditto * lib/shell/process-controller.rb (sfork): * lib/tempfile (_close, call, Tempfile.create): ditto * lib/webrick/httpauth/htdigest.rb (flush): ditto * lib/webrick/httpauth/htpasswd.rb (flush): ditto * lib/webrick/server.rb (start_thread, cleanup_shutdown_pipe): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-21ftp.rb: fix typo [ci skip]nobu
* lib/net/ftp.rb (Net::FTP#initialize): [DOC] fix type in option name, :username is used but :use is not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-21Add new options open_timeout and read_timeout to Net::FTP.new.shugo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-21Use dynamic dispatch instead of is_a?.shugo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-21net/http: avoid writing/reading from unstarted SSL socketrhe
When net/http connects to an HTTPS server through a CONNECT proxy, it writes the CONNECT request to an unconnected OpenSSL::SSL::SSLSocket. OpenSSL::SSL::SSLSocket traditionally fallbacks to a method call on the underlying IO object if a read/write method is called before the TLS connection is established. So it automagically works correctly, emitting the "SSL session is not started yet" warning. This is not obvious at first glance. The warning is also noisy. Let's just write to the plain socket instead of relying on the SSLSocket's behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-20Remove an unused variable to suppress a warning.shugo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-20forwardable/impl.rbnobu
* lib/forwardable/impl.rb (_valid_method?, _compile_method): extract to separate implementation specific part. [ruby-core:78138] [Bug #12938] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-20remote_address should be called on @bare_sock.shugo
Because @sock.remote_address fails if @sock is an SSLSocket. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-20shutdown(2) should not be called for SSLSocket.shugo
SSLSocket#stop is a private method and cannot be called, but explicit calls are not necessary because SSL_shutdown() is called from SSLSocket#close. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-19Use Socket instead of TCPSocket/TCPServer.shugo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-19Expand abbreviated option names.shugo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-19Shut down TLS connections gracefully.shugo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-19Remove garbage.shugo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-19* remove trailing spaces.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-19Support TLS and hash styles options for Net::FTP.new.shugo
If the :ssl options is specified, the control connection is protected with TLS in the manner described in RFC 4217. Data connections are also protected with TLS unless the :private_data_connection is set to false. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-16logger.rb: fix next rotate timenobu
* lib/logger.rb (Logger::LogDevice#initialize): calculate next rotate time based on the mtime of the last existing file. [ruby-dev:49881] [Bug #12948] Author: Tsukasa Oishi <tsukasa.oishi@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-15ftp.rb: use Addrinfo interfacesshugo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-15ftp.rb: use Addrinfonobu
* lib/net/ftp.rb (sendport, makeport, makepasv, BufferedSocket): use Addrinfo interfaces. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-14net/ftp.rb: kwargsnobu
* lib/net/ftp.rb (Net::FTP#open_socket): use keyword argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-14net/protocol.rb: kwargsnobu
* 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
2016-11-11Enable the document for Kernel[#.]pp.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-08Fix undefined method 'dump' for nil:NilClass (NoMethodError)a_matsuda
Patch by: Dmitry Vorotilin <d.vorotilin@gmail.com> (@route) Signed-off-by: Akira Matsuda <ronnie@dio.jp> closes #1475 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-08Fix grammar errorsa_matsuda
Patch by: Chris Tweedie <cltweedie@gmail.com> (@cltweedie) Signed-off-by: Akira Matsuda <ronnie@dio.jp> closes #1074 [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-08Update comment about default constanta_matsuda
Patch by: Dave Takahashi <dtcello@gmail.com> (@dtakahas) Signed-off-by: Akira Matsuda <ronnie@dio.jp> closes #1151 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-06irb.rb: Binding#irbnobu
* lib/irb.rb (Binding#irb): new method like Binding#pry. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-06irb.rb: IRB::Irb#runnobu
* lib/irb.rb (IRB::Irb#run): split from IRB.start. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-06e2mmap.rb: remove old definitionnobu
* lib/e2mmap.rb (E2MM.def_exception): remove old definition if exists so that works multiple times. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05shell.rb: suppress warningsnobu
* lib/shell.rb: initialize class instance variables and remove writer methods to be overwritten soon. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05e2mmap.rb: suppress a warningnobu
* lib/e2mmap.rb (bind): eval with the location. undefine predefined method before overwriting to suppress a warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e