[ruby/openssl] Add support for IO#timeout.

(https://github.com/ruby/openssl/pull/714)

* Add support for IO#timeout.

3bbf5178a9
This commit is contained in:
Samuel Williams 2024-01-18 06:08:59 +13:00 committed by git
parent 6213ab1a51
commit 4f634d3c85
4 changed files with 42 additions and 2 deletions

View file

@ -193,6 +193,24 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
}
end
def test_read_with_timeout
omit "does not support timeout" unless IO.method_defined?(:timeout)
start_server do |port|
server_connect(port) do |ssl|
str = +("x" * 100 + "\n")
ssl.syswrite(str)
assert_equal(str, ssl.sysread(str.bytesize))
ssl.timeout = 1
assert_raise(IO::TimeoutError) {ssl.read(1)}
ssl.syswrite(str)
assert_equal(str, ssl.sysread(str.bytesize))
end
end
end
def test_getbyte
start_server { |port|
server_connect(port) { |ssl|