diff options
author | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-02-15 17:50:47 +0000 |
---|---|---|
committer | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-02-15 17:50:47 +0000 |
commit | 0f2fa01a20d0e08e59f12e183a86619b587edb5c (patch) | |
tree | 42fd914ee129fd5ee85e152c6032341a2d0f3a61 /ext/openssl/lib | |
parent | 70a05a3e82c9e47757caf8d2873cf3bc80ec22d9 (diff) | |
download | ruby-0f2fa01a20d0e08e59f12e183a86619b587edb5c.tar.gz ruby-0f2fa01a20d0e08e59f12e183a86619b587edb5c.tar.xz ruby-0f2fa01a20d0e08e59f12e183a86619b587edb5c.zip |
* ext/openssl/ossl_ssl.c (ossl_ssl_read, ossl_ssl_write): should
call rb_sys_fail instead of rasing SSLError if SSL_ERROR_SYSCALL
occured.
* ext/openssl/lib/openssl/buffering.rb (Buffering#fill_rbuff):
should rescue Errno::EAGAIN.
* ext/openssl/lib/openssl/buffering.rb (Buffering#each): fix typo.
suggested by Brian Ollenberger.
* ext/openssl/lib/openssl/ssl.rb: set non-blocking flag to the
underlying IO.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/lib')
-rw-r--r-- | ext/openssl/lib/openssl/buffering.rb | 4 | ||||
-rw-r--r-- | ext/openssl/lib/openssl/ssl.rb | 10 |
2 files changed, 13 insertions, 1 deletions
diff --git a/ext/openssl/lib/openssl/buffering.rb b/ext/openssl/lib/openssl/buffering.rb index 31dcdf1f9..7ad12d720 100644 --- a/ext/openssl/lib/openssl/buffering.rb +++ b/ext/openssl/lib/openssl/buffering.rb @@ -32,6 +32,8 @@ module Buffering @rbuffer = "" unless defined? @rbuffer begin @rbuffer << self.sysread(BLOCK_SIZE) + rescue Errno::EAGAIN + retry rescue EOFError @eof = true end @@ -84,7 +86,7 @@ module Buffering end def each(eol=$/) - while line = self.gets(eol?) + while line = self.gets(eol) yield line end end diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb index 9c31fa73c..7f61fc2a6 100644 --- a/ext/openssl/lib/openssl/ssl.rb +++ b/ext/openssl/lib/openssl/ssl.rb @@ -16,6 +16,7 @@ require "openssl" require "openssl/buffering" +require "fcntl" module OpenSSL module SSL @@ -49,9 +50,18 @@ module OpenSSL end end + module Nonblock + def initialize(*args) + flag = @io.fcntl(Fcntl::F_GETFL) | File::NONBLOCK + @io.fcntl(Fcntl::F_SETFL, flag) + super + end + end + class SSLSocket include Buffering include SocketForwarder + include Nonblock def post_connection_check(hostname) check_common_name = true |