mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 13:04:13 +02:00
[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:
parent
6213ab1a51
commit
4f634d3c85
4 changed files with 42 additions and 2 deletions
|
@ -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|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue