summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@ruby-lang.org>2005-02-15 17:50:47 +0000
committergotoyuzo <gotoyuzo@ruby-lang.org>2005-02-15 17:50:47 +0000
commitfbed21f9183115d332ae54a10f41225852b3c56f (patch)
tree19aa28530f283b133a4a66d1d92002c706876a1f /lib
parentcb020d363089a7a23f2d794537a7569863b0e887 (diff)
downloadruby-openssl-history-fbed21f9183115d332ae54a10f41225852b3c56f.tar.gz
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@7974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/openssl/buffering.rb4
-rw-r--r--lib/openssl/ssl.rb10
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/openssl/buffering.rb b/lib/openssl/buffering.rb
index 31dcdf1..7ad12d7 100644
--- a/lib/openssl/buffering.rb
+++ b/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/lib/openssl/ssl.rb b/lib/openssl/ssl.rb
index 9c31fa7..7f61fc2 100644
--- a/lib/openssl/ssl.rb
+++ b/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