diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-31 04:52:18 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-31 04:52:18 +0000 |
commit | cb4d7b1a7f5dd5749bbfb750957ca458bab3eab8 (patch) | |
tree | 81c4002a3fed3a46dc352ee2dda78c5b0af264f9 /ext/openssl/lib/openssl | |
parent | d5c7938eb4c6242c86852cfec1d1f208e3087384 (diff) |
* ext/openssl/lib/openssl/buffering.rb (Buffering#read_nonblock):
implemented.
* ext/openssl/ossl_ssl.c (rb_sys_fail_path): removed.
(fcntl.h): don't include.
(ossl_ssl_read_internal): defined.
(ossl_ssl_read): use ossl_ssl_read_internal.
(ossl_ssl_read_nonblock): use ossl_ssl_read_internal.
(Init_ossl_ssl): define sysread_nonblock, instead of read_nonblock.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/lib/openssl')
-rw-r--r-- | ext/openssl/lib/openssl/buffering.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ext/openssl/lib/openssl/buffering.rb b/ext/openssl/lib/openssl/buffering.rb index 5dabcd5135..095ab248ce 100644 --- a/ext/openssl/lib/openssl/buffering.rb +++ b/ext/openssl/lib/openssl/buffering.rb @@ -99,6 +99,27 @@ module Buffering ret end + def read_nonblock(maxlen, buf=nil) + if maxlen == 0 + if buf + buf.clear + return buf + else + return "" + end + end + if @rbuffer.empty? + return sysread_nonblock(maxlen, buf) + end + ret = consume_rbuff(maxlen) + if buf + buf.replace(ret) + ret = buf + end + raise EOFError if ret.empty? + ret + end + def gets(eol=$/, limit=nil) idx = @rbuffer.index(eol) until @eof |