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

9326 Коммитов

Автор SHA1 Сообщение Дата
nobu 9bb27fa318 numeric.c: round nearly middle value
* numeric.c (flo_round): [EXPERIMENTAL] adjust the case that the
  receiver is close to the exact but unrepresentable middle value
  of two values in the given precision.
  http://d.hatena.ne.jp/hnw/20160702

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-07 07:37:55 +00:00
nobu 415059abf1 io.c: convert arguments just once
* io.c (rb_io_s_foreach, rb_io_s_readlines): convert arguments
  just once before reading, instead of conversions for each lines.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-07 07:31:09 +00:00
naruse 8667e8b186 require "rbconfig/sizeof"
They may fail parallel test-all

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-06 18:17:36 +00:00
duerst 1edb021b5c * enc/iso_8859_14.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for ISO-8859-14, by Yutaro Tada.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-06 10:54:24 +00:00
duerst 6fb97b3f32 * enc/iso_8859_15.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for ISO-8859-15, by Maho Harada.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-06 09:59:23 +00:00
duerst 79b1758b65 * enc/iso_8859_16.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for ISO-8859-16, by Satoshi Kayama.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-06 09:34:23 +00:00
shugo c74aaed016 Add an assertion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-06 00:16:17 +00:00
shugo 554c879f1f * lib/net/http/generic_rquest.rb (write_header): A Request-Line must
not contain CR or LF.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-06 00:01:20 +00:00
shugo 34a0e098f7 * 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/trunk@55579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-05 22:14:18 +00:00
hsbt 1130658738 * ext/json/*, test/json/*: Update json-2.0.1.
Changes of 2.0.0: f679ebd0c6/CHANGES.md (2015-09-11-200)
  Changes of 2.0.1: f679ebd0c6/CHANGES.md (2016-07-01-201)
  [Feature #12542][ruby-dev:49706][fix GH-1395]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-05 11:49:39 +00:00
duerst 4a41a0f7d6 * test/ruby/enc/test_case_comprehensive.rb, test_regex_casefold.rb,
test/test_unicode_normalize.rb: Replace UNICODE_VERSION from
  UnicodeNormalize with RbConfig::CONFIG['UNICODE_VERSION'] from
  feature 12460.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-03 09:51:46 +00:00
naruse 79f86a67d0 * 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/trunk@55563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-02 09:05:05 +00:00
naruse 1e3fc7dcfa * regcomp.c (noname_disable_map): don't optimize out group 0
Ruby's Regexp doesn't allow normal numbered groups if the regexp
  has named groups. On such case it optimizes out related NT_ENCLOSE.
  But even on the case it can use \g<0>.
  This fix not to remove NT_ENCLOSE whose regnum is 0.
  [ruby-core:75828] [Bug #12454]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-01 19:37:43 +00:00
ngoto 053c1e08e3 * test/fiddle/test_pointer.rb (test_to_str, test_to_s, test_aref_aset):
Attempt to use independent strings for destructive tests that
  directly modify values on memory by using Fiddle::Pointer.
  [Bug #12537] [ruby-dev:49700]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-01 10:43:07 +00:00
nobu 7d4db05679 test_stringio.rb: reduce retry count
* test/stringio/test_stringio.rb (test_overflow): reduce maximum
  retry count to get rid of timeout on some platforms.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-30 08:13:27 +00:00
shugo a1d17c5907 * test/ruby/test_refinement.rb: skip
test_prepend_after_refine_wb_miss on ARM or MIPS.
  [ruby-core:76031] [Bug #12491]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-29 03:45:23 +00:00
nobu 86a756ae15 Passed block symbol to proc
* proc.c (passed_block): convert passed block symbol to proc.
  based on the patch by Daisuke Sato in [ruby-dev:49695].
  [Bug #12531]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-28 23:45:55 +00:00
nobu ad72430863 Move CaseTest
* test/ruby/enc/test_case_comprehensive.rb (CaseTest): move under
  the test case not to pollute the global name space.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-28 07:04:13 +00:00
nobu 023aaa51a2 Skip unavailable tests
* test/ruby/enc/test_case_comprehensive.rb: noting to test if
  Unicode data files are available.
  [ruby-core:76160] [Bug #12433]
* test/test_unicode_normalize.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-28 06:56:50 +00:00
nobu 10fcca8f15 FileUtils#install: owner/group options
* lib/fileutils.rb (FileUtils#install): add owner and group
  options.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-27 07:55:17 +00:00
nobu f540475134 Coverage on non-positive lines
* compile.c (ADD_TRACE): ignore trace instruction on non-positive
  line.
* parse.y (coverage): get rid of ArgumentError when the starting
  line number is not positive.  [ruby-core:76141] [Bug #12517]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-26 23:56:57 +00:00
nobu 38f6fe64aa Refine assertion
* test/openssl/test_ocsp.rb: assert_in_delta for better message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-25 02:32:06 +00:00
rhe 5ff2e41845 openssl: ignore test failure caused by LibreSSL bug
* test/openssl/test_ocsp.rb: Ignore errors caused by bugs that exist in
  LibreSSL >= 2.3.1.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-25 01:08:15 +00:00
nobu b51174a6b0 No respond_to? as if the default definition
* vm_method.c (vm_respond_to): try method_missing if respond_to?
  is undefined, as if it is the default definition.
  [ruby-core:75377] [Bug #12353]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-24 17:33:35 +00:00
hsbt a099c5420c * ext/psych/*, test/psych/*: Upate psych 2.1.0
This version fixed [Bug #11988][ruby-core:72850]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-24 09:06:08 +00:00
hsbt bddf4b0237 * lib/rubygems.rb, lib/rubygems/*, test/rubygems/*:
Update rubygems 2.6.5 and 2.6.6.
  Release note of 2.6.5: 656f5d94dc
  Release note of 2.6.6: ccb9c3300c

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-24 04:13:11 +00:00
duerst 0546930ecb * test/ruby/enc/test_regex_casefold.rb: Add Windows-1251, KOI8-R, and
KOI8-U to encodings; definitely removed EUC-JP.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-21 10:44:57 +00:00
nobu 978ee6d1ef Multiple values X-Forwarded-Proto in webrick
* lib/webrick/httprequest.rb (setup_forwarded_info): Use the first
  value in X-Forwarded-Proto, if header contains multiple comma
  separated values.  Some middlewares may add these values to the
  list, not replacing.  [Fix GH-1386]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-21 10:32:26 +00:00
duerst 0f8a24a706 * test/ruby/test_io.rb: Skip test_readpartial_with_not_empty_buffer,
test_read_buffer_error, test_read_unlocktmp_ensure,
  test_readpartial_unlocktmp_ensure, and
  test_sysread_unlocktmp_ensure on cygwin,
  because these tests repeatedly hang. This makes test_io.rb
  complete in finite time on cygwin.
* ChangeLog: Fix test_in.rb -> test_io.rb (two instances).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-21 08:17:50 +00:00
naruse c9e9236173 It takes still too many memory...
/usr/bin/time -l make RUBYOPT=-w TESTS='-v ruby/enc/test_case_comprehensive.rb' test-all
ruby -v: ruby 2.4.0dev (2016-06-21 trunk 55473) [x86_64-freebsd10.3]
       27.74 real        27.57 user         0.16 sys
    115308  maximum resident set size
         5  average shared memory size
         4  average unshared data size
       128  average unshared stack size
     28443  page reclaims
         0  page faults
         0  swaps
         2  block input operations
         0  block output operations
         0  messages sent
         0  messages received
         0  signals received
        93  voluntary context switches
      1123  involuntary context switches

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-21 07:14:03 +00:00
duerst 8ee8a6f93c * test/ruby/test_in.rb: Skip test_read_buffer_error on cygwin,
because this test repeatedly hangs.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-21 06:42:27 +00:00
naruse f79df8459a Optimize to speed up
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-20 19:01:37 +00:00
naruse a8e5eaa4b9 Don't cache simple data to reduce memory usage
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-20 18:27:45 +00:00
duerst fda9ce3edd * test/ruby/test_in.rb: Skip test_open_fifo_does_not_block_other_threads
on cygwin. Fifos seem to work okay in cygwin, but this test repeatedly
  hangs.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-20 09:39:31 +00:00
shugo 76941e5f54 * vm.c (invoke_bmethod, invoke_block_from_c_0): revert r52104
partially to avoid "self has wrong type to call super in this
  context" errors.
  [ruby-core:72724] [Bug #11954]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-20 04:37:19 +00:00
rhe 5336399e8b rubygems: fix test for OpenSSL 1.1.0
* test/rubygems/test_gem_remote_fetcher.rb: OpenSSL::PKey::DH#priv_key=
  is not defined when ext/openssl is built with OpenSSL 1.1.0.
  https://github.com/rubygems/rubygems/pull/1648
  [ruby-core:75225] [Feature #12324]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-20 03:54:22 +00:00
rhe 102815b046 openssl: add OpenSSL::OCSP::SingleResponse
* ext/openssl/ossl_ocsp.c: Add OCSP::SingleResponse that represents an
  OCSP SingleResponse structure. Also add two new methods #responses
  and #find_response to OCSP::BasicResponse. A BasicResponse has one or
  more SingleResponse. We have OCSP::BasicResponse#status that returns
  them as an array of arrays, each containing the content of a
  SingleResponse, but this is not useful. When validating an OCSP
  response, we need to look into the each SingleResponse and check their
  validity but it is not simple. For example, when validating for a
  certificate 'cert', the code would be like:

    # certid_target is an OpenSSL::OCSP::CertificateId for cert
    basic = res.basic
    result = basic.status.any? do |ary|
      ary[0].cmp(certid_target) &&
        ary[4] <= Time.now && (!ary[5] || Time.now <= ary[5])
    end

  Adding OCSP::SingleResponse at the same time allows exposing
  OCSP_check_validity(). With this, the code above can be rewritten as:

    basic = res.basic
    single = basic.find_response(certid_target)
    result = single.check_validity

* test/openssl/test_ocsp.rb: Test this.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 12:26:27 +00:00
rhe f31f1f1adf openssl: implement initialize_copy for OpenSSL::OCSP::*
* ext/openssl/ossl_ocsp.c: Implement OCSP::{CertificateId,Request,
  BasicResponse,Response}#initialize_copy.
  [ruby-core:75504] [Bug #12381]

* test/openssl/test_ocsp.rb: Test them.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 09:42:29 +00:00
rhe be1baf4a9a openssl: implement initialize_copy method for PKey classes
* ext/openssl/ossl_pkey_dh.c, ext/openssl/ossl_pkey_dsa.c,
  ext/openssl/ossl_pkey_ec.c, ext/openssl/ossl_pkey_rsa.c: Implement
  initialize_copy method for OpenSSL::PKey::*.
  [ruby-core:75504] [Bug #12381]

* test/openssl/test_pkey_dh.rb, test/openssl/test_pkey_dsa.rb,
  test/openssl/test_pkey_ec.rb, test/openssl/test_pkey_rsa.rb: Test they
  actually copy the OpenSSL objects, and modifications to cloned object
  don't affect the original object.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 09:29:59 +00:00
duerst b67ead1452 * test/ruby/test_dir_m17n.rb: Skip tests with non-UTF-8 encodings
on cygwin. Cygwin can use the Unicode PUA (private use area) to store
  bytes from non-UTF-8 filenames (see
  https://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-specialchars),
  but we are not supporting this. [Bug #12443]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 07:55:25 +00:00
nobu 0ce3fab422 variable.c: consider length
* variable.c (rb_path_to_class): consider the string length
  instead of a terminator.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 02:19:45 +00:00
nobu b569971422 Normalization test iff UTF-8 file system
* test/ruby/test_file_exhaustive.rb (test_expand_path_compose):
  normalization is meaningless unless file system encoding is UTF.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 01:48:27 +00:00
rhe c2158dd55e openssl: avoid test crash on Ubuntu 16.04
* test/openssl/test_pkey_ec.rb (setup): Don't call EC#generate_key! for
  Oakley-* curves. This causes an odd error on Ubuntu 16.04 with openssl
  1.0.2g-1ubuntu4.1.

    begin
      OpenSSL::PKey::EC.new("Oakley-EC2N-4").generate_key
    rescue
      p $!
    end
    OpenSSL::PKey::RSA.new(512)

  This sometimes causes:

    #<OpenSSL::PKey::ECError: EC_KEY_generate_key: pairwise test failed>
    fips.c(139): OpenSSL internal error, assertion failed: FATAL FIPS SELFTEST FAILURE

  [ruby-dev:49670] [Bug #12504]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 09:10:19 +00:00
hsbt 7376907959 * test/rubygems/test_gem_installer.rb: Fixed broken test with extension
build. https://github.com/rubygems/rubygems/pull/1645

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 05:11:57 +00:00
hsbt f20ad4889d * lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems
HEAD(2c6d256). It contains to update vendored Molinillo to 0.5.0.
  https://github.com/rubygems/rubygems/pull/1638

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 05:11:55 +00:00
nobu 513345607d Refine test of r55432
* test/stringio/test_stringio.rb (test_overflow): could occur only
  on sizeof(long) >= sizeof(void*).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 04:50:14 +00:00
nobu 815e8e992d Refine test of r55432
* test/stringio/test_stringio.rb (test_overflow): refine the
  conditinon, try to allocate strings until the buffer is located
  in higher half address.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 04:40:15 +00:00
nobu ed4aed86fb stringio.c: fix index overflow
* ext/stringio/stringio.c (strio_getline): fix pointer index
  overflow.  reported by Guido Vranken <guido AT guidovranken.nl>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-17 23:52:48 +00:00
rhe 2851f19f49 openssl: allow specifying hash algorithm in OCSP::*#sign
* ext/openssl/ossl_ocsp.c (ossl_ocspreq_sign, ossl_ocspbres_sign): Allow
  specifying hash algorithm used in signing. They are hard coded to use
  SHA-1.
  Based on a patch provided by Tim Shirley <tidoublemy@gmail.com>.
  [ruby-core:70915] [Feature #11552] [GH ruby/openssl#28]

* test/openssl/test_ocsp.rb: Test sign-verify works.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-15 10:52:37 +00:00
kazu fb1cee9b6f use \A and \z instead of ^ and $ in regexp
* test/ruby/enc/test_case_comprehensive.rb
  (TestComprehensiveCaseFold::read_data): use \A and \z instead of
  ^ and $ in regexp.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 15:01:37 +00:00
rhe 0a97832e6a openssl: add some accessor methods for OCSP::CertificateId
* ext/openssl/ossl_ocsp.c (ossl_ocspcid_get_issuer_name_hash,
  ossl_ocspcid_get_issuer_key_hash, ossl_ocspcid_get_hash_algorithm):
  Add accessor methods OCSP::CertificateId#issuer_name_hash,
  #issuer_key_hash, #hash_algorithm.
  Based on a patch provided by Paul Kehrer <paul.l.kehrer@gmail.com>.
  [ruby-core:48062] [Feature #7181]

* test/openssl/test_ocsp.rb: Test these new methods.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 13:12:20 +00:00
nobu 58e8c9c895 date_strftime.c: check precision
* ext/date/date_strftime.c (date_strftime_with_tmx): reject too
  large precision to get rid of buffer overflow.
  reported by Guido Vranken <guido AT guidovranken.nl>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 13:07:27 +00:00
rhe 40799e5ef9 openssl: add missing #to_der to OCSP::{CertificateId,BasicResponse}
* ext/openssl/ossl_ocsp.c (ossl_ocspbres_to_der, ossl_ocspcid_to_der):
  Implement #to_der methods for OCSP::BasicResponse and
  OCSP::CertificateId.

  (ossl_ocspreq_initialize, ossl_ocspres_initialize): Use GetOCSP*()
  instead of raw DATA_PTR().

  (ossl_ocspbres_initialize, ossl_ocspcid_initialize): Allow
  initializing from DER string.

  (Init_ossl_ocsp): Define new #to_der methods.

* test/openssl/test_ocsp.rb: Test these changes. Also add missing tests
  for OCSP::{Response,Request}#to_der.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 12:40:55 +00:00
naruse 6965be6896 fix test of r55397
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-13 12:46:44 +00:00
nobu 75a68057c7 parse.y: no named capture conflict warnings
* parse.y (reg_named_capture_assign_iter): remove named capture
  conflict warnings.  it is just annoying rather than useful.
  [ruby-core:75416] [Bug #12359]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-13 11:50:09 +00:00
mrkn 9042cf217e numeric.c: Add Integer#digits [Feature #12447] [ruby-core:75799]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-13 11:43:54 +00:00
duerst 86e9f85553 * test/ruby/enc/test_case_comprehensive.rb: Add tests for full Unicode
swapcase.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-13 07:58:57 +00:00
nobu f54490251a dump to stdout
* test/objspace/test_objspace.rb (test_dump_all): dump to stdout
  instead of a string, get rid of hung up.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-12 14:20:50 +00:00
nobu 58edb064c3 File.expand_path compose test only on OS X
* test/ruby/test_file_exhaustive.rb (test_expand_path_compose):
  valid only on OS X.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-12 09:45:09 +00:00
duerst 60095cecc7 * test/ruby/enc/test_case_comprehensive.rb: Add tests for ASCII-only
swapcase; store calculated values in hashes.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-12 05:48:04 +00:00
rhe aefb79c24f openssl: avoid test failure in test_engine.rb
* test/openssl/test_engine.rb (test_openssl_engine_builtin,
  test_openssl_engine_by_id_string): Skip test if 'openssl' engine is
  already loaded. And test the number increased by Engine.load{_by_id,},
  not the total count of loaded engines. Previously, we called
  OpenSSL::Engine.cleanup every time running a test case, but we no
  longer can do it.
  [ruby-core:75225] [Feature #12324]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-12 04:48:10 +00:00
nobu 797f2eda58 file.c: normalize cwd
* file.c (append_fspath): normalize directory name to be appended
  on OS X.  [ruby-core:75957] [Ruby trunk Bug#12483]
  https://github.com/rails/rails/issues/25303#issuecomment-224834804

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-12 00:24:36 +00:00
nobu cfb2b14ddc ObjectSpace.dump_all: valid JSON
* ext/objspace/objspace_dump.c: generate valid JSON for dump_all.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-11 05:04:22 +00:00
duerst 02f7ad6237 * enc/iso_8859_1.c: Implement non-ASCII case mapping.
* test/ruby/enc/test_case_comprehensive.rb: Tests for above.
* string.c: Add iso-8859-1 to supported encodings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-11 00:46:21 +00:00
nobu e8700ab03d forwardable.rb: backtrace
* 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/trunk@55372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-11 00:31:30 +00:00
nobu 094a3b1162 test_forwardable.rb: operators
* test/test_forwardable.rb: add tests for operators.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-10 16:01:25 +00:00
nobu b661824e75 forwardable.rb: fix for non-module objects
* 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/trunk@55366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-10 12:54:25 +00:00
nobu 2667d1b38f hash.c: ensure NUL-terminated for ENV
* hash.c (get_env_cstr): ensure NUL-terminated.
  [ruby-dev:49655] [Bug #12475]
* string.c (rb_str_fill_terminator): return the pointer to the
  NUL-terminated content.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-10 05:48:38 +00:00
rhe f9843bc4dc openssl: use ASN1_ENUMERATED_to_BN() if needed
* ext/openssl/ossl_asn1.c (asn1integer_to_num): Use
  ASN1_ENUMERATED_to_BN() to convert an ASN1_ENUMERATED to a BN.
  Starting from OpenSSL 1.1.0, ASN1_INTEGER_to_BN() rejects
  non-ASN1_INTEGER objects. The format of INTEGER and ENUMERATED are
  almost identical so they behaved in the same way in OpenSSL <= 1.0.2.
  [ruby-core:75225] [Feature #12324]

* test/openssl/test_asn1.rb (test_decode_enumerated): Test that it
  works.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-09 12:42:08 +00:00
rhe dd05607f9a openssl: fix build with OPENSSL_NO_EC
* ext/openssl/ossl_ssl.c: Add define guards for OPENSSL_NO_EC.
  SSL_CTX_set_ecdh_auto() is defined even when ECDH is disabled in
  OpenSSL's configuration. This fixes r55214.

* test/openssl/test_pair.rb (test_ecdh_curves): Skip if the OpenSSL does
  not support ECDH.

* test/openssl/utils.rb (start_server): Ignore error in
  SSLContext#ecdh_curves=.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-09 10:46:46 +00:00
shugo 0827a7e52b * 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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-08 07:06:57 +00:00
nobu 9a4a04fe15 test_proc.rb: test_lambda?
* test/ruby/test_proc.rb (test_lambda?): lambda-ness should be
  preserved across proc, lambda, and Proc.new.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-08 02:08:00 +00:00
rhe b90516659f rubygems: regenerate server certificates used in tests
* test/rubygems/*_{cert,cert_32}.pem: Regenerate test certificates for
  OpenSSL 1.1.0. This is already in upstream.
  9be5c53939
  [ruby-core:75225] [Feature #12324]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-07 12:29:37 +00:00
svn 3cb56e8e3a * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-07 12:29:37 +00:00
rhe 06552d56d1 open-uri: regenerate server certificates used in tests
* test/open-uri/test_ssl.rb: Regenerate test certificates. The test CA
  certificate was incorrectly generated. A CA certificate must have the
  basic constraints extension with cA bit set to TRUE. OpenSSL <= 1.0.2
  allowed the error when the certificate is in the trusted store but
  OpenSSL 1.1.0 no longer does.
  [ruby-core:75225] [Feature #12324]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-07 12:29:36 +00:00
rhe b257af8859 openssl: adjust tests for OpenSSL 1.1.0
This fixes `make test-all TESTS=openssl` with OpenSSL master.

* test/openssl/test_x509name.rb: Don't register OID for 'emailAddress'
  and 'serialNumber'. A recent change in OpenSSL made OBJ_create()
  reject an already existing OID. They were needed to run tests with
  OpenSSL 0.9.6 which is now unsupported.
  https://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=52832e470f5fe8c222249ae5b539aeb3c74cdb25
  [ruby-core:75225] [Feature #12324]

* test/openssl/test_ssl_session.rb (test_server_session): Duplicate
  SSL::Session before re-adding to the session store. OpenSSL 1.1.0
  starts rejecting SSL_SESSION once removed by SSL_CTX_remove_session().
  https://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=7c2d4fee2547650102cd16d23f8125b76112ae75

* test/openssl/test_pkey_ec.rb (setup): Remove X25519 from @keys. X25519
  is new in OpenSSL 1.1.0 but this is for key agreement and not for
  signing.

* test/openssl/test_pair.rb, test/openssl/test_ssl.rb,
  test/openssl/utils.rb: Set security level to 0 when using aNULL cipher
  suites.

* test/openssl/utils.rb: Use 1024 bits DSA key for client certificates.

* test/openssl/test_engine.rb: Run each test in separate process.
  We can no longer cleanup engines explicitly as ENGINE_cleanup() was
  removed.
  https://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=6d4fb1d59e61aacefa25edc4fe5acfe1ac93f743

* ext/openssl/ossl_engine.c (ossl_engine_s_cleanup): Add a note to the
  RDoc for Engine.cleanup.

* ext/openssl/lib/openssl/digest.rb: Don't define constants for DSS,
  DSS1 and SHA(-0) when using with OpenSSL 1.1.0. They are removed.

* test/openssl/test_digest.rb, test/openssl/test_pkey_dsa.rb,
  test/openssl/test_pkey_dsa.rb, test/openssl/test_ssl.rb,
  test/openssl/test_x509cert.rb, test/openssl/test_x509req.rb: Don't
  test unsupported hash functions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-07 12:20:46 +00:00
nobu 52ccfbcdd3 test_syntax.rb: formal argument name tests
* test/ruby/test_syntax.rb: add invalid formal argument name
  tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-07 08:57:36 +00:00
duerst 768b130238 * test/ruby/enc/test_case_comprehensive: Change test for encodings
without any non-ASCII case conversions from ASCII-only test
  to full test.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-07 08:49:55 +00:00
rhe 1f5784ecaf openssl: add SSL::SSLContext#security_level{=,}
* ext/openssl/extconf.rb: Check for SSL_CTX_get_security_level().
  OpenSSL 1.1.0 introduced "security level".
  [ruby-core:75225] [Feature #12324]

* ext/openssl/ossl_ssl.c (ossl_sslctx_{get,set}_security_level): Add
  SSLContext#security_level and #security_level=.

* test/openssl/test_ssl.rb (test_security_level): Add test. ...but this
  doesn't actually test it. Because #security_level= is necessary in
  order to run other tests on OpenSSL 1.1.0, go without tests for now.
  Will fix after converting SSLContext#key= and #cert= to normal methods.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-07 07:52:24 +00:00
duerst 1b98612090 * test/ruby/enc/test_case_comprehensive: Add regression tests for
current ASCII-only case conversion.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-07 07:13:39 +00:00
duerst b5baea5f87 * test/ruby/enc/test_case_comprehensive: Fix method name
(generate_casefold_tests -> generate_case_mapping_tests).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-07 06:28:47 +00:00
nobu 65ac4a5602 vm_insnhelper.c: check symbol proc to throw
* vm_insnhelper.c (vm_throw_start): check if the iseq is symbol
  proc, class definition should not be a symbol proc.
  [ruby-core:75856] [Bug #12462]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-06 09:37:59 +00:00
duerst ab5f23f26c * string.c: Added UTF-16BE/LE and UTF-32BE/LE to supported encodings
for Unicode case mapping.
* test/ruby/enc/test_case_comprehensive.rb: Tests for above
  functionality; fixed an encoding issue in assertion error message.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-06 09:36:36 +00:00
duerst a4ccbb63cd * test/ruby/enc/test_case_comprehensive.rb: Speed up testing for small
encodings by preselecting codepoints.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-06 08:29:38 +00:00
duerst b09795d803 * test/ruby/enc/test_case_mapping.rb:
Remove :lithuanian guard for Unicode case mapping.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-06 04:16:49 +00:00
nobu 2e71c75278 Thread.report_on_exception
* thread.c (thread_start_func_2): report raised exception if
  report_on_exception flag is set.  [Feature #6647]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-06 00:25:38 +00:00
rhe 0a523ab20d openssl: adapt to OpenSSL 1.1.0 opaque structs
* ext/openssl/extconf.rb: Check existence of accessor functions that
  don't exist in OpenSSL 0.9.8. OpenSSL 1.1.0 made most of its
  structures opaque and requires use of these accessor functions.
  [ruby-core:75225] [Feature #12324]

* ext/openssl/openssl_missing.[ch]: Implement them if missing.

* ext/openssl/ossl*.c: Use these accessor functions.

* test/openssl/test_hmac.rb: Add missing test for HMAC#reset.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-05 15:35:12 +00:00
rhe 63abe00785 openssl: adapt OpenSSL::PKey to OpenSSL 1.1.0 opaque structs
* ext/openssl/openssl_missing.[ch]: Implement EVP_PKEY_get0_*() and
  {RSA,DSA,EC_KEY,DH}_get0_*() functions.
  OpenSSL 1.1.0 makes EVP_PKEY/RSA/DSA/DH opaque. We used to provide
  setter methods for each parameter of each PKey type, for example
  PKey::RSA#e=, but this is no longer possible because the new API
  RSA_set0_key() requires the 'n' at the same time. This commit adds
  deprecation warning to them and adds PKey::*#set_* methods as direct
  wrapper for those new APIs. For example, 'rsa.e = 3' now needs to be
  rewritten as 'rsa.set_key(rsa.n, 3, rsa.d)'.
  [ruby-core:75225] [Feature #12324]

* ext/openssl/ossl_pkey*.[ch]: Use the new accessor functions. Implement
  RSA#set_{key,factors,crt_params}, DSA#set_{key,pqg}, DH#set_{key,pqg}.
  Emit a warning with rb_warning() when old setter methods are used.

* test/drb/ut_array_drbssl.rb, test/drb/ut_drb_drbssl.rb,
  test/rubygems/test_gem_remote_fetcher.rb: Don't set a priv_key for DH
  object that are used in tmp_dh_callback. Generating a new key pair
  every time should be fine - actually the private exponent is ignored
  in OpenSSL >= 1.0.2f/1.0.1r even if we explicitly set.
  https://www.openssl.org/news/secadv/20160128.txt

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-05 15:00:47 +00:00
rhe 9199bec9e8 openssl: check existence of RAND_pseudo_bytes()
* ext/openssl/extconf.rb: Check if RAND_pseudo_bytes() is usable. It is
  marked as deprecated in OpenSSL 1.1.0.
  [ruby-core:75225] [Feature #12324]

* ext/openssl/ossl_rand.c: Disable Random.pseudo_bytes if
  RAND_pseudo_bytes() is unavailable.

* test/openssl/test_random.rb: Don't test Random.pseudo_bytes if not
  defined.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-05 12:38:34 +00:00
duerst 2cd799b967 * test/ruby/enc/test_case_comprehensive.rb:
Remove :lithuanian guard for Unicode case mapping.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-05 06:24:36 +00:00
duerst 3dd98b2446 * string.c: Raise ArgumentError when invalid string is detected in
case mapping methods.
* enc/unicode.c: Check for invalid string and signal with negative
  length value.
* test/ruby/enc/test_case_mapping.rb: Add tests for above.
* test/ruby/test_m17n_comb.rb: Add a message to clarify test failure.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-02 01:24:52 +00:00
rhe 1978ce784b openssl: add missing test for r55219
* test/openssl/test_asn1.rb: Add missing regression test for r55219. It
  fixed the year 2038 issue but the test code was missing.
  [ruby-core:45552] [Bug #6571]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-31 14:10:11 +00:00
nobu dd1be236d9 optparse.rb: fix char class option
* 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/trunk@55228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-31 08:28:48 +00:00
naruse e6ff652ce8 Revert r55225
Run test-all before large commit:
"* string.c: Activate full Unicode case mapping for UTF-8 by removing"

This reverts commit 3fb0fcd1e8.
http://rubyci.s3.amazonaws.com/centos5-64/ruby-trunk/log/20160531T013303Z.fail.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-31 02:56:09 +00:00
duerst 3fb0fcd1e8 * string.c: Activate full Unicode case mapping for UTF-8 by removing
the protective check for the presence of an option.
  Update documentation.
* test/ruby/enc/test_case_comprehensive.rb: Adjust tests for above change.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-31 01:10:06 +00:00
rhe b9f3d4b836 openssl: fix test failure on Fedora 23
* test/openssl/test_pair.rb (test_ecdh_curves): Avoid P-224. The FIPS
  patch from RHEL disables it. The curve has to be chosen from: {
  secp256k1, secp384r1, secp521r1, prime256v1 }.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 16:52:10 +00:00
usa 3912e4fa3b * ext/socket/raddrinfo.c (host_str, port_str): Use StringValueCStr
instead of (Safe)StringValue, to detect NUL byte in the string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 15:33:06 +00:00
nobu 77a8772b11 test_file_exhaustive.rb: writable open
* test/ruby/test_file_exhaustive.rb (test_flock_shared): open
  in writable mode for exclusive lock.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 14:07:01 +00:00
usa 0e94f4a002 * test/socket/test_addrinfo.rb (TestSocketAddrinfo#test_addrinfo_ip): previous
test logic depended on platform specific implementation.  use more portable
  logic.  this fixes a test failure on Windows.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 12:51:14 +00:00
nobu 632097082b test_addrinfo.rb: signle digit address
* test/socket/test_addrinfo.rb (test_addrinfo_ip): use single
  digit address so that the values are same in both decimal and
  octal.  some platform zero-prefixed dotted-decimal is parsed as
  an octal value.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 11:23:32 +00:00
rhe f26f358930 openssl: add SSLContext#ecdh_curves=
* ext/openssl/ossl_ssl.c (ossl_sslctx_s_alloc): Enable the automatic
  curve selection for ECDH by calling SSL_CTX_set_ecdh_auto(). With
  this a TLS server automatically selects a curve which both the client
  and the server support to use in ECDH. This changes the default
  behavior but users can still disable ECDH by excluding 'ECDH' cipher
  suites from the cipher list (with SSLContext#ciphers=). This commit
  also deprecate #tmp_ecdh_callback=. It was added in Ruby 2.3.0. It
  wraps SSL_CTX_set_tmp_ecdh_callback() which will be removed in OpenSSL
  1.1.0. Its callback receives two values 'is_export' and 'keylength'
  but both are completely useless for determining a curve to use in
  ECDH. The automatic curve selection was introduced to replace this.

  (ossl_sslctx_setup): Deprecate SSLContext#tmp_ecdh_callback=. Emit a
  warning if this is in use.

  (ossl_sslctx_set_ecdh_curves): Add SSLContext#ecdh_curves=. Wrap
  SSL_CTX_set1_curves_list(). If it is not available, this falls back
  to SSL_CTX_set_tmp_ecdh().

  (Init_ossl_ssl): Define SSLContext#ecdh_curves=.

* ext/openssl/extconf.rb: Check the existence of EC_curve_nist2nid(),
  SSL_CTX_set1_curves_list(), SSL_CTX_set_ecdh_auto() and
  SSL_CTX_set_tmp_ecdh_callback().

* ext/openssl/openssl_missing.[ch]: Implement EC_curve_nist2nid() if
  missing.

* test/openssl/test_pair.rb (test_ecdh_callback): Use
  EnvUtil.suppress_warning to suppress deprecated warning.

  (test_ecdh_curves): Test that SSLContext#ecdh_curves= works.

* test/openssl/utils.rb (start_server): Use SSLContext#ecdh_curves=.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 09:30:38 +00:00
nobu 94a91b1d60 raddrinfo.c: fix for SHARABLE_MIDDLE_SUBSTRING
* ext/socket/raddrinfo.c (host_str, port_str): use RSTRING_LEN
  instead of strlen, since RSTRING_PTR StringValueCStr may not be
  NUL-terminated when SHARABLE_MIDDLE_SUBSTRING=1.  reported by
  @tmtms, http://twitter.com/tmtms/status/736910516229005312

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 07:28:55 +00:00
nobu 79a85b18cc string.c: return reallocated pointer
* string.c (str_fill_term): return new pointer reallocated by
  filling terminator.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 07:20:28 +00:00
nobu bfc9c3766f test_addrinfo.rb: special hostnames
* test/socket/test_addrinfo.rb (test_addrinfo_ip): add tests for
  special hostnames, <any> and <broadcast>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 06:12:13 +00:00
duerst 3883bb6bae * test/test_unicode_normalize.rb: Add test to check for availability of
Unicode data file; refactoring; fix an error with tests for destructive
  method (unicode_normalize!).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-28 11:34:20 +00:00
nobu 7a622b18d9 test_file_exhaustive.rb: blocking flock
* test/ruby/test_file_exhaustive.rb (test_flock): add assertions
  for the blocking cases.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-28 10:45:48 +00:00
svn 9646e588cb * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-28 10:08:37 +00:00
duerst 62efd110f2 * test/ruby/enc/test_case_comprehensive.rb: Add error messages to tests
for data file availability; refactoring.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-28 10:08:37 +00:00
duerst 6375ad2815 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e 2016-05-28 01:37:49 +00:00
nobu c57c719e4a variable.c: hidden constants
* variable.c (rb_local_constants_i): exclude hidden constants.
  [ruby-core:75575] [Bug #12389]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-27 08:38:50 +00:00
nobu 4fad63da01 transcode.c: scrub in the given encoding
* transcode.c (str_transcode0): scrub in the given encoding when
  the source encoding is given, not in the encoding of the
  receiver.  [ruby-core:75732] [Bug #12431]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-27 08:09:46 +00:00
svn 46f6abd476 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-26 00:45:45 +00:00
duerst c1fedc8de7 * test/ruby/enc/test_case_comprehensive.rb: Add set of comprehensive
(across most Unicode characters; later across most character encodings)
  tests for case mapping.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-26 00:45:44 +00:00
naruse 05c631eefd * regparse.c (fetch_token_in_cc): raise error if given octal escaped
character is too big. [Bug #12420] [Bug #12423]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-25 09:45:22 +00:00
rhe cf2792d591 openssl: drop OpenSSL 0.9.6/0.9.7 support
* ext/openssl, test/openssl: Drop OpenSSL < 0.9.8 support.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-25 08:50:03 +00:00
naruse 8c2ddab57a * regcomp.c (compile_length_tree): return error code immediately
if compile_length_tree raised error [Bug #12418]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-25 04:21:31 +00:00
duerst ef6405f71c * enc/unicode.c: Fix flag error for switch from titlecase to lowercase.
* test/ruby/enc/test_case_mapping.rb: Tests for above error.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-24 23:01:39 +00:00
rhe 85500b6634 openssl: add EC.generate
* ext/openssl/ossl_pkey_ec.c (ec_key_new_from_group): Create a new
  EC_KEY on given EC group. Extracted from ossl_ec_key_initialize().
  (ossl_ec_key_s_generate): Added. Create a new EC instance and
  generate a random private and public key.
  (ossl_ec_key_initialize): Use ec_key_new_from_group().
  (Init_ossl_ec): Define the new method EC.generate. This change is
  for consistency with other PKey types.  [ruby-core:45541] [Bug #6567]

* test/openssl/test_pkey_ec.rb: Test that EC.generate works.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-24 16:30:15 +00:00
rhe 8cbd74a362 openssl: rename EC#generate_key to EC#generate_key!
* ext/openssl/ossl_pkey_ec.c (ossl_ec_key_generate_key): Fix up RDoc.
  (Init_ossl_ec): Rename EC#generate_key to EC#generate_key!. Make the
  old name an alias of #generate_key!. This change is for consistency
  with other PKey types.  [ruby-core:45541] [Bug #6567]

* test/openssl/test_pkey_ec.rb: Use EC#generate_key! instead of
  EC#generate_key.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-24 16:27:11 +00:00
rhe ce635262f5 openssl: make Cipher#key= and #iv= reject too long values
* ext/openssl/ossl_cipher.c (ossl_cipher_set_key, ossl_cipher_set_iv):
  Reject too long values as well as too short ones. Currently they
  just truncate the input but this would hide bugs and lead to
  unexpected encryption/decryption results.

* test/openssl/test_cipher.rb: Test that Cipher#key= and #iv= reject
  Strings with invalid length.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-24 13:09:03 +00:00
nobu 4a574f7ad9 bigdecimal.c: fix FloatDomainError
* ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): consider
  non-finite float values not to raise FloatDomainError.
  [ruby-core:75682] [Bug #12414]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-23 03:30:30 +00:00
seki 021e8ead5c use finalizer trick instead of thread.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-22 11:03:43 +00:00
duerst 0bf2e5c70b * test/ruby/enc/test_case_options.rb: adjust test class name
to match file name


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-22 08:25:18 +00:00
duerst de305716c2 * rename test/ruby/enc/test_casing_options.rb to test_case_options.rb
for consistency


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-22 08:24:08 +00:00
nobu 006634b489 -test-/integer
* ext/-test-/integer/core_ext.c: move testutil/integer.c.
* test/lib/-test-/integer.rb: extract implementation details from
  test/unit/assertions.rb.  [Bug #12408]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-22 07:27:02 +00:00
nobu b9fe5948f3 move duplicate assertions
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-22 02:28:03 +00:00
nobu 45e3b48be5 just check Integer
* test/ruby/test_bignum.rb (test_pow): just assert to be an
  Integer.

* test/ruby/test_integer_comb.rb (check_class): ditto.

* test/ruby/test_numeric.rb (test_coerce): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-21 18:09:05 +00:00
nobu a7955b31c0 hash method values
* test/ruby/test_{complex,range,rational,struct}.rb (test_hash):
  hash values should be an Integer, not only a Fixnum.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-21 18:06:04 +00:00
rhe 118ee2a734 openssl: fix possible SEGV on race between SSLSocket#stop and #connect
* ext/openssl/ossl_ssl.c (ossl_ssl_stop): Don't free the SSL struct
  here. Since some methods such as SSLSocket#connect releases GVL,
  there is a chance of use after free if we free the SSL from another
  thread. SSLSocket#stop was documented as "prepares it for another
  connection" so this is a slightly incompatible change. However when
  this sentence was added (r30090, Add toplevel documentation for
  OpenSSL, 2010-12-06), it didn't actually. The current behavior is
  from r40304 (Correct shutdown behavior w.r.t GC., 2013-04-15).
  [ruby-core:74978] [Bug #12292]

* ext/openssl/lib/openssl/ssl.rb (sysclose): Update doc.

* test/openssl/test_ssl.rb: Test this.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-21 07:25:00 +00:00
rhe 7c971e61f0 openssl: add OpenSSL::PKey::EC#private? and #public?
* ext/openssl/ossl_pkey_ec.c: rename PKey::EC#private_key? and
  #public_key? to #private? and #public? for consistency with other
  PKey types. Old names remain as alias.  [ruby-core:45541] [Bug #6567]

* test/openssl/test_pkey_ec.rb (test_check_key): check private? and
  public? works correctly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-21 05:30:48 +00:00
rhe f52ab6e494 openssl: improve handling of password for encrypted PEM
* ext/openssl/ossl.c (ossl_pem_passwd_value): Added. Convert the
  argument to String with StringValue() and validate the length is in
  4..PEM_BUFSIZE. PEM_BUFSIZE is a macro defined in OpenSSL headers.
  (ossl_pem_passwd_cb): When reading/writing encrypted PEM format, we
  used to pass the password to PEM_def_callback() directly but it was
  problematic. It is not NUL character safe. And surprisingly, it
  silently truncates the password to 1024 bytes.  [GH ruby/openssl#51]

* ext/openssl/ossl.h: Add function prototype declaration of newly
  added ossl_pem_passwd_value().

* ext/openssl/ossl_pkey.c (ossl_pkey_new_from_data): Use
  ossl_pem_passwd_value() to validate the password String.

* ext/openssl/ossl_pkey_dsa.c (ossl_dsa_initialize, ossl_dsa_export):
  ditto.

* ext/openssl/ossl_pkey_ec.c (ossl_ec_key_initialize,
  ossl_ec_key_to_string): ditto.

* ext/openssl/ossl_pkey_rsa.c (ossl_rsa_initialize, ossl_rsa_export):
  ditto.

* test/openssl/test_pkey_{dsa,ec,rsa}.rb: test this.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-20 15:05:25 +00:00
rhe c06a990806 openssl: don't test default session lifetime value
OpenSSL's default session timeout for TLS v1.0 method is not 300 seconds
but 7200. The TLS v1.0 specification[1] mentions about it as just "An
upper limit of 24 hours is suggested for session ID lifetimes,". And
according to OpenSSL 1.0.2h source comment[2], the value 7200 is decided
just because "the 24 hours mentioned in the TLSv1 spec is way too long
for http, the cache would over fill".

The reason why the default lifetime is set to 300 is maybe an OpenSSL
bug. We always call SSL_CTX_new() with SSLv23_method(), and this set
ssl_ctx->session to 300, the default value for SSLv23_method(). But the
following SSL_set_ssl_method() call does not update it. By the way this
will be fixed in OpenSSL 1.1.0.

[1] https://tools.ietf.org/html/rfc2246#appendix-F.1.4
[2] https://git.openssl.org/?p=openssl.git;a=blob;f=ssl/t1_lib.c;h=dd5bd0050d89f5585c1b06a227eb8221ebf984f1;hb=5dd94f1847c744929a3bd24819f1c99644bb18c7#l193

* test/openssl/test_ssl_session.rb (test_session): remove assertion of
  the default session timeout.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-20 04:36:03 +00:00
kazu 02942a6b90 fix document of Regexp#match?
* re.c (rb_reg_match_m_p): [DOC] fix return value in rdoc.

* test/ruby/test_regexp.rb (TestRegexp#test_match_p): add some
  tests from document.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-19 12:23:57 +00:00
usa 345d2ba145 * test/ruby/test_array.rb (TestArray#test_push_over_ary_max): it seems to take
long time on mswinci.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-19 04:34:30 +00:00
rhe a24fe080a4 openssl: check argument type in OpenSSL::X509::Attribute#value=
* ext/openssl/ossl_x509attr.c (ossl_x509attr_set_value): check that the
  argument is an OpenSSL::ASN1::Data before converting to ASN1_TYPE.
  This fixes SEGV on OpenSSL::X509::Attribute#value=(non-asn1-value).

* test/openssl/test_x509attr.rb: add tests for OpenSSL::X509::Attribute.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-19 04:12:57 +00:00
nobu 4176db205e assertions.rb: leave timeout to invoke_ruby
* test/lib/test/unit/assertions.rb (assert_separately): leave
  timeout to invoke_ruby, which handles outputs and status of the
  target process since r51539.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-19 03:46:20 +00:00
nobu a28c12af14 re.c: fix match?
* re.c (rb_reg_match_m_p): fix match against empty string.
  rb_str_offset returns the end when the position exceeds the
  length.  fix the range parameter of onig_search.
  [ruby-core:75604] [Bug #12394]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-19 03:10:12 +00:00
nobu 780c056dad re.c: match? should return nil if no match
* re.c (rb_reg_match_m_p): should return nil if no match, as the
  document says.  [Feature #8110]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-19 02:37:38 +00:00
naruse f09574c879 * re.c (rb_reg_match_m_p): Introduce Regexp#match?, which returns
bool and doesn't save backref.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 10:37:13 +00:00
rhe 898aeb8779 openssl: fix test failure due to the previous commit
* test/openssl/test_pkey_ec.rb (test_ec_point_mul): My previous commit
  r55059 was broken. I should have been more careful. Sorry.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 10:07:38 +00:00
rhe 1d1efeeafa openssl: fix test failure of OpenSSL::TestEC#test_ec_point_mul
* test/openssl/test_pkey_ec.rb (test_ec_point_mul): CentOS 7 patches
OpenSSL to reject curves defined over a small field.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 08:52:37 +00:00
nobu bbc4fd8895 test_random.rb: skip old OpenSSL
* test/openssl/test_random.rb (OpenSSL::TestRandom): ignore
  out-of-date OpenSSL before 1.0, as well as other tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 08:06:23 +00:00
nobu 1fcce422d8 openssl/test_random.rb: requires utils.rb
* test/openssl/test_random.rb: requires test/openssl/utils.rb for
  OpenSSL::TestCase now.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 07:24:02 +00:00
nobu b493d156de string.c: integer overflow
* string.c (rb_str_modify_expand): check integer overflow.
  [ruby-core:75592] [Bug #12390]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 05:52:40 +00:00
naruse b8fde96861 * re.c (match_ary_subseq): get subseq of match array without creating
temporary array.

* re.c (match_ary_aref): get element(s) of match array without creating
  temporary array.

* re.c (match_aref): Use match_ary_subseq with handling irregulars.

* re.c (match_values_at): Use match_ary_aref.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 04:56:02 +00:00
rhe c8cb26252a openssl: clear OpenSSL error queue before return to Ruby
* ext/openssl/ossl_x509cert.c (ossl_x509_verify): X509_verify()
  family may put errors on 0 return (0 means verification failure).
  Clear OpenSSL error queue before return to Ruby. Since the queue is
  thread global, remaining errors in the queue can cause an unexpected
  error in the next OpenSSL operation.  [ruby-core:48284] [Bug #7215]

* ext/openssl/ossl_x509crl.c (ossl_x509crl_verify): ditto.

* ext/openssl/ossl_x509req.c (ossl_x509req_verify): ditto.

* ext/openssl/ossl_x509store.c (ossl_x509stctx_verify): ditto.

* ext/openssl/ossl_pkey_dh.c (dh_generate): clear the OpenSSL error
  queue before re-raising exception.

* ext/openssl/ossl_pkey_dsa.c (dsa_generate): ditto.

* ext/openssl/ossl_pkey_rsa.c (rsa_generate): ditto.

* ext/openssl/ossl_ssl.c (ossl_start_ssl): ditto.

* test/openssl: check that OpenSSL.errors is empty every time after
  running a test case.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 04:07:47 +00:00
rhe 01801f2afd ext/openssl: refactor OpenSSL::PKey::EC::Point#mul
* ext/openssl/ossl_pkey_ec.c (ossl_ec_point_mul): Validate the
  arguments before passing to EC_POINT(s)_mul(). Add description of this
  method.  [ruby-core:65152] [Bug #10268]

* test/openssl/test_pkey_ec.rb (test_ec_point_mul): Test that
  OpenSSL::PKey::EC::Point#mul works.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 02:55:46 +00:00
rhe b43fd8e080 openssl: fix equality test methods of OpenSSL::BN
* ext/openssl/ossl_bn.c (try_convert_to_bnptr): Extracted from
  GetBNPtr(). This doesn't raise exception but returns NULL on error.
  (GetBNPtr): Raise TypeError if conversion fails.
  (ossl_bn_eq): Implement BN#==.
  (ossl_bn_eql): #eql? should not raise TypeError even if the argument
  is not compatible with BN.
  (ossl_bn_hash): Implement BN#hash.

* ext/openssl/ossl_bn.c (Init_ossl_bn): Define #== and #hash.

* test/openssl/test_bn.rb: Test BN#eql?, #== and #hash

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 02:55:45 +00:00
nobu 2bedfc6627 test/win32ole/test_win32ole_variant.rb: use other than Integer
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 02:05:30 +00:00
nobu 7f860741b9 re.c: fix up r55036
* re.c (match_values_at): fix regression at r55036.
  MatchData#values_at accepts Range.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17 18:16:08 +00:00