aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authoremboss <emboss@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-19 20:05:21 +0000
committeremboss <emboss@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-19 20:05:21 +0000
commit65ca601ba6de9b63b6d0507788ffa411d4d85908 (patch)
tree64f7dc9dc2468ad428d4e61cb0b62bfb4bbd50d9 /test
parent1a2f635761680408dceadcb79787e17b73680e94 (diff)
downloadruby-65ca601ba6de9b63b6d0507788ffa411d4d85908.tar.gz
* lib/openssl/buffering.rb: Force multi-byte strings to be treated as
binary data. * test/openssl/test_ssl.rb: Add test for it. Thanks to Niklas Baumstark for reporting the issue! [Ruby 1.9 - Bug #5233] [ruby-core:39120] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/openssl/test_ssl.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb
index a081931bce..ccd94cffec 100644
--- a/test/openssl/test_ssl.rb
+++ b/test/openssl/test_ssl.rb
@@ -394,6 +394,36 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
end
end
end
+
+ def test_multibyte_read_write
+ #German a umlaut
+ auml = [%w{ C3 A4 }.join('')].pack('H*')
+ auml.force_encoding(Encoding::UTF_8)
+
+ str = nil
+ num_written = nil
+
+ server_proc = Proc.new {|ctx, ssl|
+ cmp = ssl.read
+ raw_size = cmp.size
+ cmp.force_encoding(Encoding::UTF_8)
+ assert_equal(str, cmp)
+ assert_equal(num_written, raw_size)
+ ssl.close
+ }
+
+ start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true, :server_proc => server_proc){|server, port|
+ [10, 1000, 100000].each {|i|
+ sock = TCPSocket.new("127.0.0.1", port)
+ ssl = OpenSSL::SSL::SSLSocket.new(sock)
+ ssl.sync_close = true
+ ssl.connect
+ str = auml * i
+ num_written = ssl.write(str)
+ ssl.close
+ }
+ }
+ end
end
end