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 | 92c44bdb9e643f49ebde2ae0a768cacac39ab5dc (patch) | |
| tree | 81c4002a3fed3a46dc352ee2dda78c5b0af264f9 /ext/openssl/lib | |
| parent | 78e568a7f6ccb2765fc84bc897c53a6b7840ab37 (diff) | |
| download | ruby-92c44bdb9e643f49ebde2ae0a768cacac39ab5dc.tar.gz ruby-92c44bdb9e643f49ebde2ae0a768cacac39ab5dc.tar.xz ruby-92c44bdb9e643f49ebde2ae0a768cacac39ab5dc.zip | |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@21207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/lib')
| -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 5dabcd513..095ab248c 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 |
