5914 Commits
Author SHA1 Message Date
usa d32a6d37fe merge revision(s) 60584,62954-62959,63008:
webrick: support Proc objects as body responses

	* lib/webrick/httpresponse.rb (send_body): call send_body_proc
	  (send_body_proc): new method
	  (class ChunkedWrapper): new class

	* test/webrick/test_httpresponse.rb (test_send_body_proc): new test
	  (test_send_body_proc_chunked): ditto
	  [Feature #855]

	webrick: favor .write over << method

	This will make the next change to use IO.copy_stream
	easier-to-read.  When we can drop Ruby 2.4 support in a few
	years, this will allow us to use writev(2) with multiple
	arguments for headers and chunked responses.

	* lib/webrick/cgi.rb (write): new wrapper method
	  lib/webrick/httpresponse.rb: (send_header): use socket.write
	  (send_body_io): ditto
	  (send_body_string): ditto
	  (send_body_proc): ditto
	  (_write_data): ditto
	  (ChunkedWrapper#write): ditto
	  (_send_file): ditto
	------------------------------------------------------------------------
	r62954 | normal | 2018-03-28 17:05:52 +0900 (水, 28 3 2018) | 14 lines

	webrick/httpresponse: IO.copy_stream for regular files

	Remove the redundant _send_file method since its functionality
	is unnecessary with IO.copy_stream.  IO.copy_stream also allows
	the use of sendfile under some OSes to speed up copies to
	non-TLS sockets.

	Testing with "curl >/dev/null" and "ruby -run -e httpd" to
	read a 1G file over Linux loopback reveals a reduction from
	around ~0.770 to ~0.490 seconds on the client side.

	* lib/webrick/httpresponse.rb (send_body_io): use IO.copy_stream
	  (_send_file): remove
	  [Feature #14237]
	------------------------------------------------------------------------
	r62955 | normal | 2018-03-28 17:05:57 +0900 (水, 28 3 2018) | 10 lines

	webrick: use IO.copy_stream for single range response

	This is also compatible with range responses generated
	by Rack::File (tested with rack 2.0.3).

	* lib/webrick/httpresponse.rb (send_body_io): use Content-Range
	* lib/webrick/httpservlet/filehandler.rb (make_partial_content):
	  use File object for the single range case
	* test/webrick/test_filehandler.rb (get_res_body): use send_body
	  to test result
	------------------------------------------------------------------------
	r62956 | normal | 2018-03-28 17:06:02 +0900 (水, 28 3 2018) | 7 lines

	test/webrick/test_filehandler.rb: stricter multipart range test

	We need to ensure we generate compatibile output in
	the face of future changes

	* test/webrick/test_filehandler.rb (test_make_partial_content):
	  check response body
	------------------------------------------------------------------------
	r62957 | normal | 2018-03-28 17:06:08 +0900 (水, 28 3 2018) | 8 lines

	webrick: quiet warning for multi-part ranges

	Content-Length is ignored by WEBrick::HTTPResponse even if we
	calculate it, so instead we chunk responses to HTTP/1.1 clients
	and terminate HTTP/1.0 connections.

	* lib/webrick/httpservlet/filehandler.rb (make_partial_content):
	  quiet warning
	------------------------------------------------------------------------
	r62958 | normal | 2018-03-28 17:06:13 +0900 (水, 28 3 2018) | 7 lines

	webrick/httpresponse: make ChunkedWrapper copy_stream-compatible

	The .write method needs to return the number of bytes written
	to avoid confusing IO.copy_stream.

	* lib/webrick/httpresponse.rb (ChunkedWrapper#write): return bytes written
	  (ChunkedWrapper#<<): return self
	------------------------------------------------------------------------
	r62959 | normal | 2018-03-28 17:06:18 +0900 (水, 28 3 2018) | 9 lines

	webrick: use IO.copy_stream for multipart response

	Use the new Proc response body feature to generate a multipart
	range response dynamically.  We use a flat array to minimize
	object overhead as much as possible; as many ranges may fit
	into an HTTP request header.

	* lib/webrick/httpservlet/filehandler.rb (multipart_body): new method
	  (make_partial_content): use multipart_body

	get rid of test error/failure on Windows introduced at r62955

	* lib/webrick/httpresponse.rb (send_body_io): use seek if NotImplementedError
	  is raised in IO.copy_stream with offset.

	* lib/webrick/httpservlet/filehandler.rb (multipart_body): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@63014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 14:13:08 +00:00
usa a606704e84 merge revision(s) 62990:
Ignore file separator from tmpfile/tmpdir name.

	From: SHIBATA Hiroshi <hsbt@ruby-lang.org>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 10:29:15 +00:00
usa eb2aca18dc merge revision(s) 62968:
webrick: prevent response splitting and header injection

	Original patch by tenderlove (with minor style adjustments).

	* lib/webrick/httpresponse.rb (send_header): call check_header
	  (check_header): raise on embedded CRLF in header value
	* test/webrick/test_httpresponse.rb
	  (test_prevent_response_splitting_headers): new test
	* (test_prevent_response_splitting_cookie_headers): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 09:33:21 +00:00
usa 694697e3f2 merge revision(s) 62960-62965:
webrick: use IO.copy_stream for multipart response

	Use the new Proc response body feature to generate a multipart
	range response dynamically.  We use a flat array to minimize
	object overhead as much as possible; as many ranges may fit
	into an HTTP request header.

	* lib/webrick/httpservlet/filehandler.rb (multipart_body): new method
	  (make_partial_content): use multipart_body
	------------------------------------------------------------------------
	r62960 | normal | 2018-03-28 17:06:23 +0900 (水, 28 3 2018) | 13 lines

	webrick/httprequest: limit request headers size

	We use the same 112 KB limit started (AFAIK) by Mongrel, Thin,
	and Puma to prevent malicious users from using up all the memory
	with a single request.  This also limits the damage done by
	excessive ranges in multipart Range: requests.

	Due to the way we rely on IO#gets and the desire to keep
	the code simple, the actual maximum header may be 4093 bytes
	larger than 112 KB, but we're splitting hairs at that point.

	* lib/webrick/httprequest.rb: define MAX_HEADER_LENGTH
	  (read_header): raise when headers exceed max length
	------------------------------------------------------------------------
	r62961 | normal | 2018-03-28 17:06:28 +0900 (水, 28 3 2018) | 9 lines

	webrick/httpservlet/cgihandler: reduce memory use

	WEBrick::HTTPRequest#body can be passed a block to process the
	body in chunks.  Use this feature to avoid building a giant
	string in memory.

	* lib/webrick/httpservlet/cgihandler.rb (do_GET):
	  avoid reading entire request body into memory
	  (do_POST is aliased to do_GET, so it handles bodies)
	------------------------------------------------------------------------
	r62962 | normal | 2018-03-28 17:06:34 +0900 (水, 28 3 2018) | 7 lines

	webrick/httprequest: raise correct exception

	"BadRequest" alone does not resolve correctly, it is in the
	HTTPStatus namespace.

	* lib/webrick/httprequest.rb (read_chunked): use correct exception
	* test/webrick/test_httpserver.rb (test_eof_in_chunk): new test
	------------------------------------------------------------------------
	r62963 | normal | 2018-03-28 17:06:39 +0900 (水, 28 3 2018) | 9 lines

	webrick/httprequest: use InputBufferSize for chunked requests

	While WEBrick::HTTPRequest#body provides a Proc interface
	for streaming large request bodies, clients must not force
	the server to use an excessively large chunk size.

	* lib/webrick/httprequest.rb (read_chunk_size): limit each
	  read and block.call to :InputBufferSize in config.
	* test/webrick/test_httpserver.rb (test_big_chunks): new test
	------------------------------------------------------------------------
	r62964 | normal | 2018-03-28 17:06:44 +0900 (水, 28 3 2018) | 9 lines

	webrick: add test for Digest auth-int

	No changes to the actual code, this is a new test for
	a feature for which no tests existed.  I don't understand
	the Digest authentication code well at all, but this is
	necessary for the subsequent change.

	* test/webrick/test_httpauth.rb (test_digest_auth_int): new test
	  (credentials_for_request): support bodies with POST
	------------------------------------------------------------------------
	r62965 | normal | 2018-03-28 17:06:49 +0900 (水, 28 3 2018) | 18 lines

	webrick/httpauth/digestauth: stream req.body

	WARNING! WARNING! WARNING!  LIKELY BROKEN CHANGE

	Pass a proc to WEBrick::HTTPRequest#body to avoid reading a
	potentially large request body into memory during
	authentication.

	WARNING! this will break apps completely which want to do
	something with the body besides calculating the MD5 digest
	of it.

	Also, keep in mind that probably nobody uses "auth-int".
	Servers such as Apache, lighttpd, nginx don't seem to
	support it; nor does curl when using POST/PUT bodies;
	and we didn't have tests for it until now...

	* lib/webrick/httpauth/digestauth.rb (_authenticate): stream req.body

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 09:13:59 +00:00
usa 84ec88a231 merge revision(s) 62671: [Backport #14571]
resolv.rb: close socket

	* lib/resolv.rb (UnconnectedUDP#lazy_initialize): store new
	  sockets before binding, so the sockets get closed when the
	  requester is closing.

	* lib/resolv.rb (ConnectedUDP#lazy_initialize): ditto.

	* lib/resolv.rb (UnconnectedUDP#close): synchronize to get rid of
	  race condition.

	* lib/resolv.rb (ConnectedUDP#close): ditto.

	[ruby-core:85901] [Bug #14571]

	From: quixoten (Devin Christensen) <quixoten@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 06:03:13 +00:00
usa 08987d3105 merge revision(s) 61639: [Backport #14323]
net/ftp: fix FrozenError in BufferedSocket

	I noticed this bug while working on something else with
	RUBYOPT=-d on, existing test cases all passed with it.

	Note: I use String.new because it is the local style, here,
	I prefer +'' (or ''.b, for a future commit)

	* lib/net/ftp.rb (BufferedSocket#read): use String.new
	* test/net/ftp/test_buffered_socket.rb (test_read_nil): new test
	  [Bug #14323]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 05:41:54 +00:00
usa 2dee659be7 merge revision(s) 61359: [Backport #14208]
raise error if value contains CR/LF in iniheader of initialize_http_header

	like r59693, initialize_http_header also should raise error. [Bug #14208]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 04:54:58 +00:00
usa bec19f4962 merge revision(s) 55372: [Backport #14179]
* lib/forwardable.rb (_delegator_method): leave the backtrace
	  untouched during accessor.  forwardable.rb does not appear in
	  the backtrace during delegated method because of tail-call
	  optimization.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-18 15:04:49 +00:00
usa 08fb5c2153 merge revision(s) 58471,58493,62436: [Backport #13505]
load.c: backtrace of circular require

	* load.c (load_lock): print backtrace of circular require via
	  `Warning.warn` [ruby-core:80850] [Bug #13505]

	  Send the backtrace of the circular require warning as a single String to Warning.warn

	* load.c: send as a single string.
	* error.c: expose the string formatted by rb_warning as rb_warning_string().
	* test/ruby/test_exception.rb: update tests.
	  [ruby-core:80850] [Bug #13505]

	fix regexp literal warning.

	* test/rubygems/test_gem_server.rb: eliminate duplicated character class warning.
	  [Bug #14481]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-16 16:21:44 +00:00
usa ecb7182f93 merge revision(s) 60021: [Backport #13926]
HTTPHeader#add_field should allow binary [Bug #13926]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-31 11:47:49 +00:00
usa 937457fee8 merge revision(s) 59372: [Backport #13649]
lib/net/imap.rb: Ignore trailing space for Microsoft Exchange Server

	Based on the patch by keysen (Jeremy Carlier).
	[ruby-core:81641] [Bug #13649]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-31 11:26:08 +00:00
usa 59475e5805 merge revision(s) 57887: [Backport #13159]
lib/ostruct.rb: [DOC] revise docs for OpenStruct

	* update paragraph on implementation:
	  define_singleton_method is used, not define_method
	* add call-seq with return values for each_pair
	* adopt description of dig from Array and Hash
	* fix description of the hash method
	* :nodoc: initialize_copy, respond_to_missing?
	* other small improvements, e.g. use the term `attribute' in the docs
	  (instead of `member'), which is clearer for users of the class
	* improve code examples: e.g. use more consistent style (always use
	  double quotes, drop `p' and `puts', ...), update inspect output,
	  use example data that is not prone to change (like population)
	* add more code examples
	* fix some small errors and grammar

	[ruby-core:79265] [Bug #13159]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-31 11:05:38 +00:00
usa 735496826b merge revision(s) 55265: [Backport #14182]
* lib/mkmf.rb (create_makefile): sort lists of source and object
	  files in generated Makefile, unless given by extconf.rb.
	  [Fix GH-1367]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-31 10:52:30 +00:00
usa 1cfe43fd85 merge revision(s) 61242: [Backport #14185]
Fix a command injection vulnerability in Net::FTP.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@61248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-14 13:55:41 +00:00
usa ccbe964c1f merge revision(s) 61197: [Backport #14184]
webrick: compile RE correctly for beginning and end match

	Using ^ and $ in regexps means we can accidentally get fooled
	by "%0a" in HTTP request paths being decoded to newline
	characters.  Use \A and \z to match beginning and end-of-string
	respectively, instead.

	Thanks to mame and hsbt for reporting.

	* lib/webrick/httpserver.rb (MountTable#compile):
	  use \A and \z instead of ^ and $
	* lib/webrick/httpserver.rb (MountTable#normalize): use \z instead of $
	* test/webrick/test_httpserver.rb (test_cntrl_in_path): new test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@61241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-14 13:36:50 +00:00
usa 1beda2970b merge revision(s) 60172,60189,60208,60210,60211: [Backport #14005]
webrick: do not hang acceptor on slow TLS connections

	OpenSSL::SSL::SSLSocket#accept may block indefinitely on clients
	which negotiate the TCP connection, but fail (or are slow) to
	negotiate the subsequent TLS handshake.  This prevents the
	multi-threaded WEBrick server from accepting other connections.

	Since the TLS handshake (via OpenSSL::SSL::SSLSocket#accept)
	consists of normal read/write traffic over TCP, handle it in the
	per-client thread, instead.

	Furthermore, using non-blocking accept() is useful for non-TLS
	sockets anyways because spurious wakeups are possible from
	select(2).

	* lib/webrick/server.rb (accept_client): use TCPServer#accept_nonblock
	  and remove OpenSSL::SSL::SSLSocket#accept call
	* lib/webrick/server.rb (start_thread): call OpenSSL::SSL::SSLSocket#accept
	* test/webrick/test_ssl_server.rb (test_slow_connect): new test
	  [ruby-core:83221] [Bug #14005]

	webrick: fix up r60172

	By making the socket non-blocking in r60172, TLS/SSL negotiation
	via the SSL_accept function must handle non-blocking sockets
	properly and retry on SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE.
	OpenSSL::SSL::SSLSocket#accept cannot do that properly with a
	non-blocking socket, so it must use non-blocking logic of
	OpenSSL::SSL::SSLSocket#accept_nonblock.

	Thanks to MSP-Greg (Greg L) for finding this.

	* lib/webrick/server.rb (start_thread): use SSL_accept properly
	  with non-blocking socket.
	  [Bug #14013] [Bug #14005]

	webrick: fix up r60172 and revert r60189

	Thanks to MSP-Greg (Greg L) for helping with this.

	* lib/webrick/server.rb (start_thread): ignore ECONNRESET, ECONNABORTED,
	  EPROTO, and EINVAL on TLS negotiation errors the same way they
	  were ignored before r60172 in the accept_client method of the
	  main acceptor thread.
	  [Bug #14013] [Bug #14005]

	webrick: fix up r60172 and r60208

	Thanks to MSP-Greg (Greg L) for helping with this.

	* lib/webrick/server.rb (start_thread): fix non-local return
	  introduced in r60208

	webrick: fix up r60172 and r60210

	Thanks to MSP-Greg (Greg L) for helping with this.

	* lib/webrick/server.rb (start_thread): properly fix non-local return
	  introduced in r60208 and r60210

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@61240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-14 13:33:54 +00:00
usa 9ad0239992 merge revision(s) 60149: [Backport #14003]
Merge rubygems-2.6.14 changes.

	  It fixed http://blog.rubygems.org/2017/10/09/unsafe-object-deserialization-vulnerability.html

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@60946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-30 14:29:32 +00:00
usa 3896b48678 merge revision(s) 59897:
lib/webrick/log.rb: sanitize any type of logs

	It had failed to sanitize some type of exception messages.  Reported and
	patched by Yusuke Endoh (mame) at https://hackerone.com/reports/223363

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14 11:26:53 +00:00
usa add060094c merge revision(s) 59693,59695: [Backport #13852]
A HTTP Header value must not contain CR or LF.
	to_str -> to_s

	* lib/net/http/header.rb (set_field): `val` can not have `to_str`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-09 13:50:10 +00:00
usa dbe8e9c578 merge revision(s) 59584: [Backport #13850]
REXML: Fix a bug that unexpected methods can be called as a XPath function

	[HackerOne:249295]

	Reported by Andrea Jegher. Thanks!!!


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-09 13:42:22 +00:00
usa afc45931e8 * lib/rubygems: fix several vulnerabilities in RubyGems; bump to version
2.5.2.1. [Backport #13842]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-09 13:37:16 +00:00
usa 87cacf7e68 merge revision(s) 56576,56623: [Backport #12678] [Backport #13429]
* lib/net/smtp.rb (tlsconnect): support timeout for TLS handshake.
	  [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.

	* test/net/smtp/test_smtp.rb (test_tls_connect, test_tls_connect):
	  use Socket.tcp_server_sockets in case localhost is resolved to ::1.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-09 08:10:56 +00:00
usa 177cb2c15b merge revision(s) 59312: [Backport #13739]
optparse.rb: get rid of eval

	* lib/optparse.rb: try Float() and Integer() instead of eval,
	  which does too much things.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-09 07:56:52 +00:00
usa e1f73c3219 merge revision(s) 57446: [Backport #13413]
mkmf.rb: fix script installation

	* lib/mkmf.rb (MakeMakefile): fix condition to install script
	  files.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-07 06:00:04 +00:00
usa 971b99f3ed merge revision(s) 59033,59034: [Backport #13636]
rexml: add close tag check on end of document to StreamParser

	[ruby-core:81593] [Bug #13636]

	Reported by Anton Sivakov. Thanks!!!

	* properties.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-30 12:58:41 +00:00
usa 30519c0b6a merge revision(s) 58552: [Backport #13531]
rss: Accept empty text element as valid element

	Parser has been accepted it but XML serializer wasn't accepted.

	Reported by stefano frabetti. Thanks!!!

	[ruby-core:80965] [Bug #13531]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-30 12:48:27 +00:00
usa 1b5f534487 merge revision(s) 55324,55325: [Backport #13651]
* lib/net/smtp.rb (getok, get_response): raise an ArgumentError when
	  CR or LF is included in a line, because they are not allowed in
	  RFC5321.
	  RFC5321.  Thanks, Jeremy Daer.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-30 12:10:59 +00:00
usa 17b77906af merge revision(s) 58825,58826: [Backport #5339]
erb.rb: Allow explicit trimming carriage return

	when trim_mode is "-", for Windows environments.

	[ruby-core:39625] [Bug #5339]
	erb.rb: Allow trimming CR in all trim_modes

	to unify a behavior with r58823 and r58825.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-30 11:24:41 +00:00
usa 2d909334c0 merge revision(s) 58823: [Backport #11464]
erb.rb: Allow trimming carriage return

	when trim_mode is "<>", for Windows environments.

	[Bug #11464]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-30 11:18:02 +00:00
nagachika 0dc5e45028 merge revision(s) 57640: [Backport #13214]
fileutils.rb: do not make root

	* lib/fileutils.rb (FileUtils#mkdir_p): no need to make root
	  directory which should be exist and cannot be made with mkdir
	  recent Cygwin can make a directory contains a colon.
	  [Bug #13214]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@58180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-27 16:57:39 +00:00
nagachika 7f04247e6d merge revision(s) 57515: [Backport #13169]
lib/ostruct.rb: Fix returned value of each_pair.

	From a patch by Marcus Stollsteimer. [Fixes #13169]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@58178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-27 16:55:20 +00:00
nagachika 8f3cf2cc09 merge revision(s) 57027: [Backport #13012]
ruby-lex.rb: fix for label

	* lib/irb/ruby-lex.rb (identify_identifier): treat identifier just
	  followed by a colon as a lable.  this is not a precise solution
	  but enough for the time being.  [ruby-core:78526] [Bug #13012]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@58170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-27 16:09:31 +00:00
nagachika e3defadb78 merge revision(s) 58077: [Backport #13358]
ostruct.rb: fix OpenStruct.allocate

	* lib/ostruct.rb (OpenStruct.allocate): initialize an instance
	  variable directly, without calling `intialize` method which may
	  be overridden in a subclass.  [ruby-core:80292] [Bug #13358]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@58161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-27 15:37:55 +00:00
nagachika 57d0c36a28 merge revision(s) 57972: [Backport #13198]
Fix bug of Tempfile#size if nothing is written [Bug #13198]

	* lib/tempfile.rb (Tempfile#size): Fix its behavior when nothing
	  is written. Tempfile#size should return 0 in this case.
	  The patch is from nobu <nobu@ruby-lang.org>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@58154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-27 14:47:38 +00:00
nagachika 4919dbabdb merge revision(s) 56139,57066,57099,57100: [Backport #10774]
* lib/uri/mailto.rb: Removed needless `return` and use `.`` instead of `::`
	  with class method.

	* test/uri/test_mailto.rb: Added tests for coverage.

	Use URI.decode_www_form_component [Bug #10774]

	`parser` refered RFC2396_Parser, but it is separated.
	test is contributed by Dominik Menke
	test_mailto.rb: adjust scope
	test_mailto.rb: overwritten methods

	* test/uri/test_mailto.rb (URI::TestMailTo#test_to_mailtext):
	  merge overwritten methods.  [Bug #10774]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@58147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-27 11:13:31 +00:00
nagachika 1034b6d23d merge revision(s) 53383,55366: [Backport #12478]
* lib/forwardable.rb (def_instance_delegator): adjust backtrace of
	  method body by tail call optimization.  adjusting the delegated
	  target is still done by deleting backtrace.

	* lib/forwardable.rb (def_single_delegator): ditto.

	* lib/forwardable.rb (Forwardable._delegator_method): extract
	  method generator and deal with non-module objects.
	  [ruby-dev:49656] [Bug #12478]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@57570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-07 17:18:46 +00:00
nagachika f82fd950c1 merge revision(s) 53668: [Backport #12759]
* lib/tempfile.rb (Tempfile#initialize): [DOC] the first parameter
	  `basename` is optional and defaulted to an empty string since
	  [GH-523].  [Fix GH-1225]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@56858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-21 07:56:47 +00:00
nagachika edf505a7e8 merge revision(s) 56596: [Backport #12890]
* lib/net/http.rb (transport_request): other than HTTPContinue
	  in 1xx (HTTPInformation) also needs to continue. [Bug #12890]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@56782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-14 17:48:09 +00:00
nagachika 7c0c4c8e5e merge revision(s) 56374: [Backport #12822]
* lib/logger.rb (Logger::Period#next_rotate_time): fix monthly log
	  rotate when DST is applied during a month of 31 days.
	  [Fix GH-1458]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@56438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-17 17:38:53 +00:00
nagachika 67351ac6f5 * lib/rubygems/ssl_certs/GlobalSignRootCA.pem: add for RugyGems.org.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@56369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-06 17:48:47 +00:00
nagachika d45d826f94 merge revision(s) 56166: [Backport #12766]
* lib/uri/generic.rb (def check_password): don't include bad password
	  in URI exception output

	* test/uri/test_generic.rb (def test_set_component): test for behavior


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@56243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-25 21:33:38 +00:00
nagachika 996b1bfa95 merge revision(s) 53707,53708,53709,53712,53777,53781: [Backport #12326]
* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems-2.5.2.
	  It supports to enable frozen string literal and add `--norc` option for
	  disable to `.gemrc` configuration.
	  See 2.5.2 release notes for other fixes and enhancements.
	  https://github.com/rubygems/rubygems/blob/a8aa3bac723f045c52471c7b9328310a048561e0/History.txt#L3

	* lib/rubygems/specification.rb: `coding` is affect only first line except
	  shebang.

	* lib/rubygems/package.rb, lib/rubygems/package/*: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@56003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-24 15:28:23 +00:00
nagachika f376d0efe2 merge revision(s) 55726,55727: [Backport #12609]
* lib/rexml/attribute.rb (REXML::Attribute#to_string): Fix wrong
	  entry reference name of double quote.
	  [Bug#12609][ruby-core:76509]
	  Patch by Joseph Marrero. Thanks!!!
	  [Bug #12609][ruby-core:76509]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-18 14:06:38 +00:00
nagachika eed566debe merge revision(s) 55563: [Backport #12498]
* lib/uri/mailto.rb (initialize): RFC3986_Parser#split sets opaque
	  only if the URI has path-rootless, not path-empty.
	  [ruby-core:76055] [Bug #12498]
	  patched by Chris Heisterkamp <cheister@squareup.com>


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-16 02:48:59 +00:00
nagachika 55992aa430 merge revision(s) 55581,55582,55880: [Backport #12557]
* lib/net/http/generic_request.rb (write_header): A Request-Line must
	  not contain CR or LF.

	* lib/net/http/generic_request.rb (write_header): A Request-Line must


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-15 20:00:09 +00:00
nagachika 94231bdf79 merge revision(s) 55579: [Backport #12556]
* lib/net/ftp.rb (putline): raise an ArgumentError when
	  CR or LF is included in a line.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-15 19:56:19 +00:00
nagachika c20b07d535 merge revision(s) 55008: [Backport #12342]
* lib/drb/timeridconv.rb: don't use keeper thread. [Bug #12342]

	* test/drb/ut_timerholder.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-11 18:30:09 +00:00
nagachika 1bc8bf2766 merge revision(s) 55731: [Backport #12610]
* lib/webrick/httpservlet/cgihandler.rb (do_GET): delete HTTP_PROXY

	* test/webrick/test_cgi.rb (test_cgi_env): new test

	* test/webrick/webrick.cgi (do_GET): new endpoint to dump env
	  [ruby-core:76511] [Bug #12610]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-01 17:26:35 +00:00
nagachika a11bb4fa91 merge revision(s) 55228: [Backport #12438]
* lib/optparse.rb (OptionParser::Completion.candidate): get rid of
	  nil as key names.  [ruby-core:75773] [Bug #12438]

	* lib/optparse.rb (OptionParser#make_switch): char class option
	  cannot be NoArgument, default to RequiredArgument.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 17:47:36 +00:00
nagachika 97888037f1 merge revision(s) 54999: [Backport #12379]
* lib/mkmf.rb (pkg_config): use xsystem consistently to set up
	  library path environment variable as well as latter pkg-config
	  calls.  [ruby-dev:49619] [Bug #12379]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-14 17:46:54 +00:00