dumping ground for random patches and texts
 help / color / mirror / Atom feed
* [PATCH] test/openssl/test_ssl.rb (test_copy_stream): new test
@ 2015-11-25 21:52 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2015-11-25 21:52 UTC (permalink / raw)
  To: spew

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.
---
 test/openssl/test_ssl.rb | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb
index 9e98a21..06e8d96 100644
--- a/test/openssl/test_ssl.rb
+++ b/test/openssl/test_ssl.rb
@@ -178,6 +178,20 @@ def test_read_and_write
     }
   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|
-- 
EW


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-25 21:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-25 21:52 [PATCH] test/openssl/test_ssl.rb (test_copy_stream): new test Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).