summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/openssl/lib/openssl/buffering.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/openssl/lib/openssl/buffering.rb b/ext/openssl/lib/openssl/buffering.rb
index 8800aa53cc..5dabcd5135 100644
--- a/ext/openssl/lib/openssl/buffering.rb
+++ b/ext/openssl/lib/openssl/buffering.rb
@@ -99,7 +99,7 @@ module Buffering
ret
end
- def gets(eol=$/)
+ def gets(eol=$/, limit=nil)
idx = @rbuffer.index(eol)
until @eof
break if idx
@@ -111,6 +111,9 @@ module Buffering
else
size = idx ? idx+eol.size : nil
end
+ if limit and limit >= 0
+ size = [size, limit].min
+ end
consume_rbuff(size)
end