Граф коммитов

311 Коммитов

Автор SHA1 Сообщение Дата
normal 7830a950ef net/pop: make modified strings mutable
Thanks to Michael Zimmerman for the bug report

* lib/net/pop.rb: make modified strings mutable
  [ruby-core:85210] [Bug #14416]
* test/net/pop/test_pop.rb: new test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-30 00:22:22 +00:00
normal e56d34001f 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
  [ruby-core:84675] [Bug #14323]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-06 09:21:35 +00:00
ko1 c39bdb798d `$SAFE` as a process global state. [Feature #14250]
* vm_core.h (rb_vm_t): move `rb_execution_context_t::safe_level` to
  `rb_vm_t::safe_level_` because `$SAFE` is a process (VM) global state.

* vm_core.h (rb_proc_t): remove `rb_proc_t::safe_level` because `Proc`
  objects don't need to keep `$SAFE` at the creation.
  Also make `is_from_method` and `is_lambda` as 1 bit fields.

* cont.c (cont_restore_thread): no need to keep `$SAFE` for Continuation.

* eval.c (ruby_cleanup): use `rb_set_safe_level_force()` instead of access
  `vm->safe_level_` directly.

* eval_jump.c: End procs `END{}` doesn't keep `$SAFE`.

* proc.c (proc_dup): removed and introduce `rb_proc_dup` in vm.c.

* safe.c (rb_set_safe_level): don't check `$SAFE` 1 -> 0 changes.

* safe.c (safe_setter): use `rb_set_safe_level()`.

* thread.c (rb_thread_safe_level): `Thread#safe_level` returns `$SAFE`.
  It should be obsolete.

* transcode.c (load_transcoder_entry): `rb_safe_level()` only returns
  0 or 1 so that this check is not needed.

* vm.c (vm_proc_create_from_captured): don't need to keep `$SAFE` for Proc.

* vm.c (rb_proc_create): renamed to `proc_create`.

* vm.c (rb_proc_dup): moved from proc.c.

* vm.c (vm_invoke_proc): do not need to set and restore `$SAFE`
  for `Proc#call`.

* vm_eval.c (rb_eval_cmd): rename a local variable to represent clearer
  meaning.

* lib/drb/drb.rb: restore `$SAFE`.

* lib/erb.rb: restore `$SAFE`, too.

* test/lib/leakchecker.rb: check `$SAFE == 0` at the end of tests.

* test/rubygems/test_gem.rb: do not set `$SAFE = 1`.

* bootstraptest/test_proc.rb: catch up this change.

* spec/ruby/optional/capi/string_spec.rb: ditto.

* test/bigdecimal/test_bigdecimal.rb: ditto.

* test/fiddle/test_func.rb: ditto.

* test/fiddle/test_handle.rb: ditto.

* test/net/imap/test_imap_response_parser.rb: ditto.

* test/pathname/test_pathname.rb: ditto.

* test/readline/test_readline.rb: ditto.

* test/ruby/test_file.rb: ditto.

* test/ruby/test_optimization.rb: ditto.

* test/ruby/test_proc.rb: ditto.

* test/ruby/test_require.rb: ditto.

* test/ruby/test_thread.rb: ditto.

* test/rubygems/test_gem_specification.rb: ditto.

* test/test_tempfile.rb: ditto.

* test/test_tmpdir.rb: ditto.

* test/win32ole/test_win32ole.rb: ditto.

* test/win32ole/test_win32ole_event.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-28 20:09:24 +00:00
shugo c55200763d Extend timeout for CI.
http://ci.rvm.jp/results/trunk-asserts-nopara@ruby-sky1/266962

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-21 23:28:15 +00:00
naruse 0078e40115 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/trunk@61359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-20 12:06:59 +00:00
nagachika 6d3f72e5be Fix a command injection vulnerability in Net::FTP.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-14 13:41:30 +00:00
eregon 15689ed778 Fix test-all tests to avoid creating report_on_exception warnings
* The warnings are shown by Thread.report_on_exception defaulting to
  true. [Feature #14143] [ruby-core:83979]
* Improves tests by narrowing down the scope where an exception
  is expected.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12 18:44:49 +00:00
shugo 04594937eb remove unnecessary read_timeout.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-06 23:56:04 +00:00
shugo 65c0f47f7e Remove unnecessary read_timeout.
http://ci.rvm.jp/results/trunk-asserts-nopara@ruby-sky1/219867

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-05 00:59:40 +00:00
rhe 55953e374d openssl: revert changes in SSLContext#{min,max}_version= in r60310
And adapt a net/http test to their old behavior.  [ruby-core:83491]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-25 14:12:07 +00:00
naruse 3acc0ba1d8 Host header should add branckets to IPv6 address [Bug #12642]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26 15:29:36 +00:00
naruse 9ba147dce6 OpenSSL may show the different error message
d02211c9da (commitcomment-25119729)
From: MSP-Greg <MSP-Greg@users.noreply.github.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-23 08:28:05 +00:00
hsbt 6693e3e723 Fixed misspelling words.
These are detected by https://github.com/client9/misspell

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-22 11:27:06 +00:00
naruse d02211c9da ignore server side error
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 16:44:56 +00:00
naruse b39132e993 Revert "ignore server side error"
This reverts commit r60314.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 16:44:56 +00:00
naruse facccd3129 ignore server side error
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 16:43:54 +00:00
naruse 800da42cc6 fic expected error message
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 16:34:34 +00:00
naruse dcea9198a9 Introduce Net::HTTP#min_version/max_version [Feature #9450]
Set SSL minimum/maximum version.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 16:25:22 +00:00
kazu 5f6b04223f Fix leaked file descriptor
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-03 12:06:14 +00:00
naruse c4130b0958 Net::HTTP.new: Support no_proxy parameter [Feature #11195]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-28 10:51:37 +00:00
naruse 4f4d724720 Make retries for Net::HTTP configurable [Feature #10674]
by stereobooster
fix https://github.com/ruby/ruby/pull/1654

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-26 14:00:25 +00:00
naruse 56f91c6ec5 HTTPHeader#add_field should allow binary [Bug #13926]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-25 14:28:53 +00:00
naruse 16225d823d include query parameters in Net::HTTP.post
patched by Samuel Giddins <segiddins@segiddins.me>
https://github.com/ruby/ruby/pull/1686 fix GH-1686

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-15 16:53:55 +00:00
naruse 427f5b5713 A HTTP Header value must not contain CR or LF.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-30 17:24:05 +00:00
shugo 21e4ade56b lib/net/imap.rb: Accept continuation requests without response text
The IMAP server of DOCOMO returns such continuation requests.
[ruby-list:50558]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-27 06:32:00 +00:00
shugo bf210cfce9 test/net/imap/test_imap.rb: Use Addrinfo.tcp in case localhost is ::1.
[ruby-dev:50208] [Bug #13825]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-18 05:16:05 +00:00
kazu 53b88cc66c Use `&.` instead of modifier if
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-01 00:19:10 +00:00
shugo ae91976d56 lib/net/imap.rb: support CHANGEDSINCE and MODSEQ
Patch by plehoux (Philippe-Antoine Lehoux).  [ruby-core:64272] [Feature #10119]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-26 07:47:34 +00:00
shugo 016586824f lib/net/imap.rb: Ignore trailing space for Microsoft Exchange Server
Based on the patch by keysen (Jérémy Carlier).
[ruby-core:81641] [Bug #13649]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-19 23:08:34 +00:00
nobu c31de52fa5 test_http.rb: fix r58855
* test/net/http/test_http.rb (test_s_start): git rid of error when
  failed to start a connection.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24 13:30:54 +00:00
nobu 0a2546842f fix FD leaks
* test/net/http/test_http.rb (test_s_start): finish connections to
  get rid of FD leaks.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23 12:38:01 +00:00
normal cbedbaf9d9 lib/net/protocol.rb: account read_bytes before caller sees it
Users may modify the chunk yielded to them in Net::HTTPResponse#read_body.
This will allow users to reduce memory usage by calling
String#clear on the buffer once they're done using it.

* lib/net/protocol.rb (read): increment read_bytes earlier
  (read_all): ditto
* test/net/http/test_httpresponse.rb (test_read_body_block_mod): new test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-22 07:36:00 +00:00
shugo 27fb27ff42 net/imap: separate @continuation_request_exception from @exception
Otherwise literal data will be sent even if NO response is returned
because @exception is set to nil in receive_responses.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-22 06:13:11 +00:00
naruse a1b924f0f1 Clean proxy
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 15:58:16 +00:00
naruse 67723c1e46 Net::HTTP#start now pass :ENV to p_addr by default [Bug #13351]
To avoid this, pass nil explicitly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 15:13:42 +00:00
shugo 84c1596342 net/imap: Net::IMAP#append should not block when NO response is received
[ruby-dev:50129] [Bug#13579]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 09:25:52 +00:00
ko1 a9b001a4eb skip openssl related tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-16 04:23:10 +00:00
shugo b7ff46b7a4 test/net/imap: fix race condition in test_exception_during_idle
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-13 02:05:40 +00:00
shugo cea73b2df9 net/imap: Net::IMAP#disconnect need not do anything if already disconnected
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-11 07:56:52 +00:00
naruse c7ec1b1f59 Allow Net::HTTP to fetch user/pass from http_proxy
Note that this feature is enabled only on environment variables are
multi-user safe. In this time the list includes Linux, FreeBSD, or
Darwin. [Bug #12921]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-23 16:19:23 +00:00
ko1 4032f45dc2 Terminate created threads.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-13 16:19:46 +00:00
nobu 3408e9e3c3 revert r57323
StringIO.new makes the buffer IO.default_external, while
StringIO.new("".dup) makes source encoding which is defaulted to
UTF-8.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-14 09:38:56 +00:00
nobu c8a4b57254 StringIO.new makes a RW buffer
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-14 02:06:22 +00:00
kazu 6ca3028eec lib/net/smtp.rb: Specify frozen_string_literal: true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-12 12:17:33 +00:00
shugo 58935eb8bd lib/net/protocol.rb: preserve backtrace information
BufferedIO#rbuf_fill should preserve backtrace information when raising
EOFError.  Otherwise, users get confused when EOFError is leaked out from
Net::SMTP etc.  [ruby-core:78550] [Bug #13018]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-12 02:19:17 +00:00
kazu 3e34d8a44f lib/net/protocol.rb: Specify frozen_string_literal: true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-11 14:48:51 +00:00
kazu 1dd076c557 lib/net/pop.rb: Specify frozen_string_literal: true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-10 12:32:56 +00:00
shugo 7a5ad716d0 Specify the socktype explicitly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-04 05:05:54 +00:00
shugo 94e8036b85 Use 127.0.0.1 if getaddrinfo fails.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-04 04:53:33 +00:00
shugo 071d3ae301 Use IPv6 if it's preferred.
I hope this fix makes tests faster on Windows.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-03 15:41:14 +00:00