summaryrefslogtreecommitdiff
path: root/ext/openssl
diff options
context:
space:
mode:
authorGrant Gardner <[email protected]>2024-07-01 00:25:45 +1000
committergit <[email protected]>2024-07-03 08:54:18 +0000
commit4d4ac00123aa21d3027bcd0aa0242c1bc129837e (patch)
treee8aad397dc7c684d16af3f1461eebdb5dc7e889b /ext/openssl
parent93b19d56de64fdee790a96ddf96fcd08d889ac93 (diff)
[ruby/openssl] Add SSLSocket#readbyte
Companion to getbyte but raise EOFError Similar to https://github.com/ruby/openssl/pull/438 https://github.com/ruby/openssl/commit/c40f70711a
Diffstat (limited to 'ext/openssl')
-rw-r--r--ext/openssl/lib/openssl/buffering.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/openssl/lib/openssl/buffering.rb b/ext/openssl/lib/openssl/buffering.rb
index d0b4b18038..85f593af0f 100644
--- a/ext/openssl/lib/openssl/buffering.rb
+++ b/ext/openssl/lib/openssl/buffering.rb
@@ -107,6 +107,12 @@ module OpenSSL::Buffering
read(1)&.ord
end
+ # Get the next 8bit byte. Raises EOFError on EOF
+ def readbyte
+ raise EOFError if eof?
+ getbyte
+ end
+
##
# Reads _size_ bytes from the stream. If _buf_ is provided it must
# reference a string which will receive the data.