* 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
This commit is contained in:
parent
e65affb360
commit
a579d8bf68
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
|||||||
|
Wed Feb 16 02:47:45 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
Mon Feb 14 23:58:17 2005 Kouhei Sutou <kou@cozmixng.org>
|
Mon Feb 14 23:58:17 2005 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
* lib/rss/parser.rb (RSS::ListenerMixin::tag_end):
|
* lib/rss/parser.rb (RSS::ListenerMixin::tag_end):
|
||||||
|
@ -32,6 +32,8 @@ module Buffering
|
|||||||
@rbuffer = "" unless defined? @rbuffer
|
@rbuffer = "" unless defined? @rbuffer
|
||||||
begin
|
begin
|
||||||
@rbuffer << self.sysread(BLOCK_SIZE)
|
@rbuffer << self.sysread(BLOCK_SIZE)
|
||||||
|
rescue Errno::EAGAIN
|
||||||
|
retry
|
||||||
rescue EOFError
|
rescue EOFError
|
||||||
@eof = true
|
@eof = true
|
||||||
end
|
end
|
||||||
@ -84,7 +86,7 @@ module Buffering
|
|||||||
end
|
end
|
||||||
|
|
||||||
def each(eol=$/)
|
def each(eol=$/)
|
||||||
while line = self.gets(eol?)
|
while line = self.gets(eol)
|
||||||
yield line
|
yield line
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
require "openssl"
|
require "openssl"
|
||||||
require "openssl/buffering"
|
require "openssl/buffering"
|
||||||
|
require "fcntl"
|
||||||
|
|
||||||
module OpenSSL
|
module OpenSSL
|
||||||
module SSL
|
module SSL
|
||||||
@ -49,9 +50,18 @@ module OpenSSL
|
|||||||
end
|
end
|
||||||
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
|
class SSLSocket
|
||||||
include Buffering
|
include Buffering
|
||||||
include SocketForwarder
|
include SocketForwarder
|
||||||
|
include Nonblock
|
||||||
|
|
||||||
def post_connection_check(hostname)
|
def post_connection_check(hostname)
|
||||||
check_common_name = true
|
check_common_name = true
|
||||||
|
@ -517,7 +517,7 @@ ossl_ssl_read(int argc, VALUE *argv, VALUE self)
|
|||||||
continue;
|
continue;
|
||||||
case SSL_ERROR_SYSCALL:
|
case SSL_ERROR_SYSCALL:
|
||||||
if(ERR_peek_error() == 0 && nread == 0) rb_eof_error();
|
if(ERR_peek_error() == 0 && nread == 0) rb_eof_error();
|
||||||
ossl_raise(eSSLError, "SSL_read: %s", strerror(errno));
|
rb_sys_fail(0);
|
||||||
default:
|
default:
|
||||||
ossl_raise(eSSLError, "SSL_read:");
|
ossl_raise(eSSLError, "SSL_read:");
|
||||||
}
|
}
|
||||||
@ -556,6 +556,8 @@ ossl_ssl_write(VALUE self, VALUE str)
|
|||||||
case SSL_ERROR_WANT_READ:
|
case SSL_ERROR_WANT_READ:
|
||||||
rb_thread_schedule();
|
rb_thread_schedule();
|
||||||
continue;
|
continue;
|
||||||
|
case SSL_ERROR_SYSCALL:
|
||||||
|
rb_eof_error();
|
||||||
default:
|
default:
|
||||||
ossl_raise(eSSLError, "SSL_write:");
|
ossl_raise(eSSLError, "SSL_write:");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user