summaryrefslogtreecommitdiff
path: root/lib/net
AgeCommit message (Collapse)Author
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-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-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-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-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-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-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-05* lib/net/http.rb (Net::HTTP.post): new convenience method to send a POST ↵shugo
request. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05* lib/net/http.rb (transport_request): other than HTTPContinuenaruse
in 1xx (HTTPInformation) also needs to continue. [Bug #12890] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05* lib/net/smtp.rb (tlsconnect): support timeout for TLS handshake.shugo
[ruby-core:76893] [Bug #12678] * lib/net/protocol.rb (ssl_socket_connect): new method to implement timeout for TLS handshake. * lib/net/http.rb (connect): use Net::Protocol#ssl_socket_connect. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-05* lib/net/http/response.rb: Improve document readability.hsbt
[fix GH-1411][ci skip] Patch by @stz-seongheon git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-11Update URL of Japanese document of net/popkazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-16* lib/net/http/header.rb: Fix typo. [ci skip][fix GH-1407]hsbt
* transcode.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-06* lib/net/http/generic_rquest.rb (write_header): A Request-Line mustshugo
not contain CR or LF. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-05* lib/net/ftp.rb (putline): raise an ArgumentError whenshugo
CR or LF is included in a line. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-28Cache no proxy casenobu
* lib/net/http.rb (Net::HTTP#proxy_uri): cache the case no proxy is used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-28Use conditional operatornobu
* lib/net/http.rb (Net::HTTP#proxy): use conditional operator to get rid of confusing ruby-mode.el. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-11Remove dead link [ci skip]nobu
* lib/net/smtp.rb: [DOC] Remove dead link on documentation for Japanese of SMTP. [Fix GH-1380] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-08* lib/net/smtp.rb (getok, get_response): raise an ArgumentError whenshugo
CR or LF is included in a line, because they are not allowed in RFC5321. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-04* lib/net/http/header.rb: [DOC] add documentation thatktsj
Net::HTTPHeader#{each_header,each_name,each_capitalized_name, each_value,each_capitalized} without block returns an enumerator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-04* lib/net/http/header.rb (Net::HTTPHeader#{each_header,each_name,ktsj
each_capitalized_name,each_value,each_capitalized}): Return sized enumerators. * test/net/http/test_httpheader.rb: add test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-25net/http/header.rb: refactornobu
* lib/net/http/header.rb (connection_close?): match headers without making intermediate arrays. * lib/net/http/header.rb (connection_keep_alive?): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-22* lib/net/http.rb: Improve documentation for SSL requests via GET method.hsbt
[fix GH-1325][ci skip] Patch by @jsyeo git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-12net/ftp.rb: NullSocket#closed?nobu
* net/ftp.rb: add NullSocket#closed? to fix closing not opened connection. [Fix GH-1232] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-29* lib/net/http/header.rb: Warn nil variable on HTTP Header.hsbt
It caused to NoMethodError. [fix GH-952][fix GH-641] Patch by @teosz * test/net/http/test_httpheader.rb: Added test for nil HTTP Header. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-10stdlib: avoid extra calls to eliminate "\n" from Base64normal
We may use the '0' (zero) to avoid adding the line feed. Furthermore, the '*' (asterisk) modifier is not needed for a single-element arrays. * ext/psych/lib/psych/visitors/yaml_tree.rb (visit_String): eliminate chomp * lib/net/http.rb (connect): eliminate delete * lib/net/http/header.rb (basic_encode): ditto * lib/net/imap.rb (authenticate): eliminate gsub (self.encode_utf7): shorten delete arg * lib/net/smtp.rb (base64_encode): eliminate gsub * lib/open-uri.rb (OpenURI.open_http): eliminate delete * lib/rss/rss.rb: ditto * lib/securerandom.rb (base64): ditto (urlsafe_base64): eliminate delete! * lib/webrick/httpauth/digestauth.rb (split_param_value): eliminate chop * lib/webrick/httpproxy.rb (do_CONNECT): eliminate delete (setup_upstream_proxy_authentication): ditto [ruby-core:72666] [Feature #11938] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30* lib/net/http/responses.rb: Added new response class for 451 status code.hsbt
* lib/net/http.rb: documentation for HTTPUnavailableForLegalReasons git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-23[DOC] Fix typosa_matsuda
* benchmark.rb * getoptlong.rb * irb.rb * net/http.rb * net/http/header.rb * net/imap.rb * optparse.rb * pstore.rb * webrick.rb * xmlrpc.rb [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e