mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test/openssl/test_ssl.rb (test_copy_stream): new test
I was worried r52750 would break IO.copy_stream with things like OpenSSL sockets which wrap IOs, but require data to be run through through encryption/decryption filters. Apparently my worry was unfounded, but perhaps this test will ensure this case continues to work. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7d92e5cf73
commit
14920f93c9
2 changed files with 18 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
|||
Thu Nov 26 07:22:55 2015 Eric Wong <e@80x24.org>
|
||||
|
||||
* test/openssl/test_ssl.rb (test_copy_stream): new test
|
||||
|
||||
Wed Nov 25 21:23:39 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* io.c (copy_stream_body): try to_io conversion before read,
|
||||
|
|
|
@ -178,6 +178,20 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
|||
}
|
||||
end
|
||||
|
||||
def test_copy_stream
|
||||
start_server(OpenSSL::SSL::VERIFY_NONE, true) do |server, port|
|
||||
server_connect(port) do |ssl|
|
||||
IO.pipe do |r, w|
|
||||
str = "hello world\n"
|
||||
w.write(str)
|
||||
IO.copy_stream(r, ssl, str.bytesize)
|
||||
IO.copy_stream(ssl, w, str.bytesize)
|
||||
assert_equal str, r.read(str.bytesize)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_client_auth_failure
|
||||
vflag = OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
|
||||
start_server(vflag, true, :ignore_listener_error => true){|server, port|
|
||||
|
|
Loading…
Add table
Reference in a new issue