summaryrefslogtreecommitdiff
path: root/test/openssl
AgeCommit message (Collapse)Author
2015-04-13* ext/openssl/lib/openssl/ssl.rb: stricter hostname verificationnagachika
following RFC 6125. with the patch provided by Tony Arcieri and Hiroshi Nakamura [ruby-core:61545] [Bug #9644] * test/openssl/test_ssl.rb: add tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-12connect_nonblock supports "exception: false"normal
This is for consistency with accept_nonblock arguments and gives a minor speedup from avoiding exceptions. [ruby-core:68838] [Feature #11024] * ext/openssl/ossl_ssl.c (ossl_ssl_connect_nonblock): support `exception: false' * (get_no_exception): move function location * ext/socket/socket.c (sock_connect_nonblock): support `exception: false' * test/openssl/test_pair.rb (test_connect_accept_nonblock_no_exception): test `exception: false' on connect, rename from `test_accept_nonblock_no_exception' * test/socket/test_nonblock.rb (test_connect_nonblock_no_exception): new test Benchmark results: default 0.050000 0.100000 0.150000 ( 0.151307) exception: false 0.030000 0.080000 0.110000 ( 0.108840) ----------------------------8<----------------------- require 'socket' require 'benchmark' require 'io/wait' require 'tmpdir' host = '127.0.0.1' serv = TCPServer.new(host, 0) # UNIX sockets may not hit EINPROGRESS nr = 5000 # few iterations to avoid running out of ports addr = serv.getsockname pid = fork do begin serv.accept.close rescue => e warn "#$$: #{e.message} (#{e.class})" end while true end at_exit { Process.kill(:TERM, pid) } serv.close Benchmark.bmbm do |x| x.report("default") do nr.times do s = Socket.new(:INET, :STREAM) s.setsockopt(:SOL_SOCKET, :SO_REUSEADDR, 1) begin s.connect_nonblock(addr) rescue IO::WaitWritable s.wait_writable end s.close end end x.report("exception: false") do nr.times do s = Socket.new(:INET, :STREAM) s.setsockopt(:SOL_SOCKET, :SO_REUSEADDR, 1) case s.connect_nonblock(addr, exception: false) when :wait_writable s.wait_writable end s.close end end end git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-12accept_nonblock supports "exception: false"normal
This is analogous to functionality found in IO#read_nonblock and IO#wait_nonblock. Raising exceptions for common failures on non-blocking servers is expensive and makes $DEBUG too noisy. Benchmark results: user system total real default 2.790000 0.870000 3.660000 ( 3.671597) exception: false 1.120000 0.800000 1.920000 ( 1.922032) exception: false (cached arg) 0.820000 0.770000 1.590000 ( 1.589267) --------------------- benchmark script ------------------------ require 'socket' require 'benchmark' require 'tmpdir' nr = 1000000 Dir.mktmpdir('nb_bench') do |path| sock_path = "#{path}/test.sock" s = UNIXServer.new(sock_path) Benchmark.bmbm do |x| x.report("default") do nr.times do begin s.accept_nonblock rescue IO::WaitReadable end end end x.report("exception: false") do nr.times do begin s.accept_nonblock(exception: false) rescue IO::WaitReadable abort "should not raise" end end end x.report("exception: false (cached arg)") do arg = { exception: false } nr.times do begin s.accept_nonblock(arg) rescue IO::WaitReadable abort "should not raise" end end end end end * ext/socket/init.c (rsock_s_accept_nonblock): support exception: false [ruby-core:66385] [Feature #10532] * ext/socket/init.c (rsock_init_socket_init): define new symbols * ext/socket/rubysocket.h: adjust prototype * ext/socket/socket.c (sock_accept_nonblock): support exception: false * ext/openssl/ossl_ssl.c (ossl_ssl_accept_nonblock): ditto * ext/socket/socket.c (Init_socket): adjust accept_nonblock definition * ext/openssl/ossl_ssl.c (Init_ossl_ssl): ditto * ext/socket/tcpserver.c (rsock_init_tcpserver): ditto * ext/socket/unixserver.c (rsock_init_unixserver): ditto * ext/socket/tcpserver.c (tcp_accept_nonblock): adjust rsock_s_accept_nonblock call * ext/socket/unixserver.c (unix_accept_nonblock): ditto * ext/openssl/ossl_ssl.c (ossl_start_ssl): support no_exception * ext/openssl/ossl_ssl.c (ossl_ssl_connect): adjust ossl_start_ssl call * ext/openssl/ossl_ssl.c (ossl_ssl_connect_nonblock): ditto * ext/openssl/ossl_ssl.c (ossl_ssl_accept): ditto * test/socket/test_nonblock.rb (test_accept_nonblock): test for "exception :false" * test/socket/test_tcp.rb (test_accept_nonblock): new test * test/socket/test_unix.rb (test_accept_nonblock): ditto * test/openssl/test_pair.rb (test_accept_nonblock_no_exception): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-13test_cipher.rb: ignore wrap mode errosnobu
* test/openssl/test_cipher.rb (test_ciphers): ignore wrap mode errors if "wrap" is contained in the name. seems no explicit rules. http://rubyci.blob.core.windows.net/fedora21/ruby-trunk/log/20150213T001502Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-12test_random.rb: addnobu
* test/openssl/test_random.rb (OpenSSL::TestRandom): add minimum tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-12test_cipher.rb: show cipher namenobu
* test/openssl/test_cipher.rb (test_ciphers): show wrap mode cipher name, which does not end with "wrap". http://rubyci.blob.core.windows.net/fedora21/ruby-trunk/log/20150212T061502Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-06test_cipher.rb: OpenSSL 1.0.2nobu
* test/openssl/test_cipher.rb (OpenSSL::TestCipher#test_ciphers): OpenSSL 1.0.2 does not allow wrap mode. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-02* test/openssl/test_ssl_session.rb (OpenSSL#test_ctx_client_session_cb):hsbt
fix test failure with OpenSSL disabled SSLv3 protocol. [ruby-core:63772] [Bug #10046] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-13* test/openssl/test_pkey_ec.rb: ignored tests with old OpenSSL.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-13test/openssl: skip old OpenSSLnobu
* test/openssl/utils.rb (OpenSSL::TestUtils): ignore out-of-date OpenSSL before 1.0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-13revert r48819nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-13test_ocsp.rb: run separatelynobu
* test/openssl/test_ocsp.rb (test_new_ocsp_request): run in a separated process to continue on CentOS 5.6 i386. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13* test/lib/envutil.rb: Moved from test/ruby/.akr
* test/lib/find_executable.rb: Ditto. * test/lib/memory_status.rb: Ditto. * test/lib/test/unit.rb: require envutil. * test/: Don't require envutil in test files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13* test/openssl: Don't specify port number.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13* test/openssl/ssl_server.rb: Unused file removed.akr
It is not used since r16111, Ruby 1.9.1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-03* test/openssl/utils.rb: The default of :ignore_listener_error isakr
changed to false. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-01* test/openssl/test_ssl.rb: Don't ignore errors on listener threads,akr
as much as possible. * test/openssl/test_ssl_session.rb: Ditto. * test/openssl/test_partial_record_read.rb: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-01ignore_ssl_accept_error option is changed to ignore_listener_error.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-01start_server refined.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-01* test/openssl/utils.rb (start_server): Don't close sockets beforeakr
threads finished. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-01* test/openssl/test_ssl_session.rb (test_ctx_client_session_cb): Don'takr
ignore errors of SSL accept. (test_ctx_server_session_cb): Ditto. * test/openssl/utils.rb (server_loop): Add ignore_ssl_accept_error argument. (start_server): Refine threads waits. * test/ruby/envutil.rb (assert_join_threads): Show a thread before backtrace. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-01* test/openssl/utils.rb (start_server, server_loop): Use aakr
pipe to stop server instead of shutdown/close a listening socket. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-31* test/openssl/test_ssl.rb: Add certificate verification chainheadius
test from JRuby community. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-03* test/openssl/test_pkey_rsa.rb (OpenSSL#test_sign_verify_memory_leak):hsbt
added timeout into testcase for low performance environment. [Bug #9984][ruby-core:63367] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-13* test/openssl/test_ssl_session.rb: fix indent.hsbt
contributed from @spk. [fix GH-698] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-11add timeoutnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-23test_x509req.rb: fix for RHEL7nobu
* test/openssl/test_x509req.rb (test_sign_and_verify_rsa_md5): fix exception to be rescued. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-23RHEL7 disables MD5naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-22split assertions into algorithmsnaruse
CentOS 7 seems finish MD5 support http://chkbuild005.hsbt.org/chkbuild/ruby-trunk/log/20140722T140010Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-23* test/openssl/test_509cert.rb: force sorted order for order-headius
sensitive test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-03* test/openssl/test_ssl.rb (OpenSSL::TestSSL#test_verify_result):usa
shouldn't use same server for respective tests, because the 1st test sometimes kills the server main loop silently. [Bug #9881] [ruby-dev:48266] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-01Suppress warnings.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-29* ext/openssl/lib/openssl/ssl.rb (SSLServer#accept): Close a socketakr
if any exception occur. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-28Close fds.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-28* ext/openssl/ossl_ssl.c (ossl_ssl_close): Fix sync_close to workakr
when SSL is not started. This fix the fd leak by test_https_proxy_authentication in test/net/http/test_https_proxy.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27* test/lib/minitest/unit.rb: Use Tempfile#close! instead ofakr
Tempfile#unlink to close file descriptors. * test/openssl/test_config.rb: Ditto. * test/ruby/test_io.rb: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27* test/openssl/test_pkcs7.rb: Fix inverted expected and actual values.kou
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27* test/openssl/test_pair.rb: Modify TestSSL#test_read_and_writehsbt
to handle partial sysreads. [Bug #7398][ruby-core:49563] * test/openssl/test_ssl.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27* remove trailing spaces.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27* test/openssl/test_pkcs7.rb: Add tests for PKCS7#type= and add_data.hsbt
[Feature #7399][ruby-core:49565] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27* test/openssl/test_hmac.rb (test_binary_update): Added Test forhsbt
HMAC signing with UTF-8 String. [Bug #7512][ruby-core:50559] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-25* test/openssl: Join threads.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-25* test/openssl/test_partial_record_read.rb: Testing read_nonblock onhsbt
a partial TLS record results in IO::WaitReadable by @mohamedhafez. [fix GH-547] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-07refactored to test Socket and TCPSocket/TCPServer more consistently.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-07* ext/openssl/lib/openssl/ssl.rb (OpenSSL::SSL::SSLServer#accept):akr
Consider Socket#accept as well as TCPServer#accept. Reported by Sam Stelfox. [ruby-core:62064] [Bug #9750] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-07refactoring to extract tcp_pair.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-16ossl_pkey.c: fix memory leaknobu
* ext/openssl/ossl_pkey.c (ossl_pkey_verify): as EVP_VerifyFinal() finalizes only a copy of the digest context, the context must be cleaned up after initialization by EVP_MD_CTX_cleanup() or a memory leak will occur. [ruby-core:62038] [Bug #9743] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-07* test/openssl/test_ssl.rb: Reuse TLS default options fromemboss
OpenSSL::SSL::SSLContext::DEFAULT_PARAMS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-06fix r45274; it change default but doesn't change tests [Bug #9424]naruse
RUN TESTS BEFORE COMMIT!!! git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-28* ext/openssl/ossl_ssl.c: pass read_nonblock options to underlying IOtenderlove
when SSL session has not been started. * test/openssl/test_ssl.rb: test for change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e