Bug #1907
closedssl_timeout cannot be set in HTTPS request
Description
=begin
Net::HTTPS defines SSL_ATTRIBUTES which, as I understand, are attributes that can be set on an HTTP object and includes ssl_timeout
However when applying these attributes on the SSLContext, the following exception is raised:
NoMethodError: undefined method ssl_timeout=' for #<OpenSSL::SSL::SSLContext:0x6511fc> from /usr/local/lib/ruby19/1.9.1/openssl/ssl.rb:39:in
block in set_params'
from /usr/local/lib/ruby19/1.9.1/openssl/ssl.rb:39:in each' from /usr/local/lib/ruby19/1.9.1/openssl/ssl.rb:39:in
set_params'
from /usr/local/lib/ruby19/1.9.1/net/http.rb:591:in connect' from /usr/local/lib/ruby19/1.9.1/net/http.rb:574:in
do_start'
from /usr/local/lib/ruby19/1.9.1/net/http.rb:563:in start' from /usr/local/lib/ruby19/1.9.1/net/http.rb:1094:in
request'
from (irb):16
from /usr/local/bin/irb:12:in `'
The code being run is:
require 'net/https'
http = Net::HTTP.new("example.com")
http.use_ssl = true
http.ssl_timeout = 1
http.request('hi') # exception is raised here
SSLContext does not implement ssl_timeout= but it does have timeout=, so this attribute should be handled specially, or perhaps be aliased in SSLContext?
=end
Updated by mame (Yusuke Endoh) about 14 years ago
- Assignee set to yugui (Yuki Sonoda)
=begin
Hi,
Net::HTTPS defines SSL_ATTRIBUTES which, as I understand, are attributes that can be set on an HTTP object and includes
ssl_timeout
However when applying these attributes on the SSLContext, the following exception is raised:
I'm not familiar with net/https and openssl, but
perhaps be aliased in SSLContext?
I think it is reasonable because there are
- SSLContext#timeout,
- SSLContext#timeout=, and
- SSLContext#ssl_timeout (as alias to SSLContext#timeout)
but not SSLContext#ssl_timeout=.
Adding `ssl_timeout=' may be considered as a new feature. But, the
symptom OP reported is certainly a bug, and adding it is most
appropriate fix the symptom, I think.
Yugui, may I commit the following patch?
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index fe6e74f..e70a868 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -1577,6 +1577,7 @@ Init_ossl_ssl()
for(i = 0; i < numberof(ossl_sslctx_attrs); i++)
rb_attr(cSSLContext, rb_intern(ossl_sslctx_attrs[i]), 1, 1, Qfalse);
rb_define_alias(cSSLContext, "ssl_timeout", "timeout");
- rb_define_alias(cSSLContext, "ssl_timeout=", "timeout=");
rb_define_method(cSSLContext, "initialize", ossl_sslctx_initialize, -1);
rb_define_method(cSSLContext, "ssl_version=", ossl_sslctx_set_ssl_version, 1);
rb_define_method(cSSLContext, "ciphers", ossl_sslctx_get_ciphers, 0);
--
Yusuke Endoh mame@tsg.ne.jp
=end
Updated by yugui (Yuki Sonoda) about 14 years ago
=begin
may I commit the following patch?
OK.
2010/04/10 12:30 "Yusuke Endoh" redmine@ruby-lang.org:
Issue #1907 has been updated by Yusuke Endoh.
Assigned to set to Yuki Sonoda
Hi,
Net::HTTPS defines SSL_ATTRIBUTES which, as I understand, are attributes
that can be set on an HT...
I'm not familiar with net/https and openssl, but
perhaps be aliased in SSLContext?
I think it is reasonable because there are
- SSLContext#timeout,
- SSLContext#timeout=, and
- SSLContext#ssl_timeout (as alias to SSLContext#timeout)
but not SSLContext#ssl_timeout=.
Adding `ssl_timeout=' may be considered as a new feature. But, the
symptom OP reported is certainly a bug, and adding it is most
appropriate fix the symptom, I think.
Yugui, may I commit the following patch?
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index fe6e74f..e70a868 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -1577,6 +1577,7 @@ Init_ossl_ssl()
for(i = 0; i < numberof(ossl_sslctx_attrs); i++)
rb_attr(cSSLContext, rb_intern(ossl_sslctx_attrs[i]), 1, 1, Qfalse);
rb_define_alias(cSSLContext, "ssl_timeout", "timeout");
- rb_define_alias(cSSLContext, "ssl_timeout=", "timeout=");
rb_define_method(cSSLContext, "initialize", ossl_sslctx_initialize,
-1);
rb_define_method(cSSLContext, "ssl_version=",
ossl_sslctx_set_ssl_version, 1);
rb_define_method(cSSLContext, "ciphers", ossl_sslctx_get_ciphers,
0);
--
Yusuke Endoh mame@tsg.ne.jp
http://redmine.ruby-lang.org/issues/show/1907¶
> may I commit the following patch?
OK.
2010/04/10 12:30 "Yusuke Endoh" <redmine@ruby-lang.org>:
Issue #1907 has been updated by Yusuke Endoh.
Assigned to set to Yuki Sonoda
Hi,
I'm not familiar with net/https and openssl, but
> Net::HTTPS defines SSL_ATTRIBUTES which, as I understand, are attributes that can be set on an HT...
I think it is reasonable because there are
> perhaps be aliased in SSLContext?
- SSLContext#timeout,
- SSLContext#timeout=, and
- SSLContext#ssl_timeout (as alias to SSLContext#timeout)
but not SSLContext#ssl_timeout=.
Adding `ssl_timeout=' may be considered as a new feature. But, the
symptom OP reported is certainly a bug, and adding it is most
appropriate fix the symptom, I think.
Yugui, may I commit the following patch?
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index fe6e74f..e70a868 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -1577,6 +1577,7 @@ Init_ossl_ssl()
for(i = 0; i < numberof(ossl_sslctx_attrs); i++)
rb_attr(cSSLContext, rb_intern(ossl_sslctx_attrs[i]), 1, 1, Qfalse);
rb_define_alias(cSSLContext, "ssl_timeout", "timeout");
+ rb_define_alias(cSSLContext, "ssl_timeout=", "timeout=");
rb_define_method(cSSLContext, "initialize", ossl_sslctx_initialize, -1);
rb_define_method(cSSLContext, "ssl_version=", ossl_sslctx_set_ssl_version, 1);
rb_define_method(cSSLContext, "ciphers", ossl_sslctx_get_ciphers, 0);
--
Yusuke Endoh <mame@tsg.ne.jp>
----------------------------------------
http://redmine.ruby-lang.org/issues/show/1907
----------------------------------------
=end
Updated by shyouhei (Shyouhei Urabe) over 13 years ago
- Status changed from Open to Assigned
=begin
=end
Updated by jeremyevans0 (Jeremy Evans) over 4 years ago
- Status changed from Assigned to Closed
- Description updated (diff)