зеркало из https://github.com/github/ruby.git
* ext/openssl/ossl_ssl.c (ossl_ssl_close): Fix sync_close to work
when SSL is not started. This fix the fd leak by test_https_proxy_authentication in test/net/http/test_https_proxy.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
73cf9abd1c
Коммит
02afafb42a
|
@ -1,3 +1,10 @@
|
||||||
|
Wed May 28 18:06:13 2014 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* ext/openssl/ossl_ssl.c (ossl_ssl_close): Fix sync_close to work
|
||||||
|
when SSL is not started.
|
||||||
|
This fix the fd leak by test_https_proxy_authentication in
|
||||||
|
test/net/http/test_https_proxy.rb.
|
||||||
|
|
||||||
Wed May 28 10:29:28 2014 Eric Wong <e@80x24.org>
|
Wed May 28 10:29:28 2014 Eric Wong <e@80x24.org>
|
||||||
|
|
||||||
* vm.c (rb_vm_living_threads_foreach): remove function
|
* vm.c (rb_vm_living_threads_foreach): remove function
|
||||||
|
|
|
@ -1566,19 +1566,23 @@ static VALUE
|
||||||
ossl_ssl_close(VALUE self)
|
ossl_ssl_close(VALUE self)
|
||||||
{
|
{
|
||||||
SSL *ssl;
|
SSL *ssl;
|
||||||
|
VALUE io;
|
||||||
|
|
||||||
ossl_ssl_data_get_struct(self, ssl);
|
/* ossl_ssl_data_get_struct() is not usable here because it may return
|
||||||
|
* from this function; */
|
||||||
|
|
||||||
if (ssl) {
|
Data_Get_Struct(self, SSL, ssl);
|
||||||
VALUE io = ossl_ssl_get_io(self);
|
|
||||||
|
io = ossl_ssl_get_io(self);
|
||||||
if (!RTEST(rb_funcall(io, rb_intern("closed?"), 0))) {
|
if (!RTEST(rb_funcall(io, rb_intern("closed?"), 0))) {
|
||||||
|
if (ssl) {
|
||||||
ossl_ssl_shutdown(ssl);
|
ossl_ssl_shutdown(ssl);
|
||||||
SSL_free(ssl);
|
SSL_free(ssl);
|
||||||
|
}
|
||||||
DATA_PTR(self) = NULL;
|
DATA_PTR(self) = NULL;
|
||||||
if (RTEST(ossl_ssl_get_sync_close(self)))
|
if (RTEST(ossl_ssl_get_sync_close(self)))
|
||||||
rb_funcall(io, rb_intern("close"), 0);
|
rb_funcall(io, rb_intern("close"), 0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
|
@ -680,6 +680,15 @@ end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_sync_close_without_connect
|
||||||
|
Socket.open(:INET, :STREAM) {|s|
|
||||||
|
ssl = OpenSSL::SSL::SSLSocket.new(s)
|
||||||
|
ssl.sync_close = true
|
||||||
|
ssl.close
|
||||||
|
assert(s.closed?)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def start_server_version(version, ctx_proc=nil, server_proc=nil, &blk)
|
def start_server_version(version, ctx_proc=nil, server_proc=nil, &blk)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче