summaryrefslogtreecommitdiff
path: root/ext/openssl/lib
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-17 07:06:16 +0000
committergotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-17 07:06:16 +0000
commitd4f5b77d3ab62c0b05feb2897bf93b2b3032dfeb (patch)
treef2efd03643d52ab9fe792bbc13c6320dee5397a8 /ext/openssl/lib
parent1e8c6e2ba4eb4305a756f650248283ecad4f36cb (diff)
* ext/openssl/lib/openssl/buffering.rb (Buffering#gets): added second
optional argument to specify maximum length limit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/lib')
-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