Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed ssl_reuse test when using newer OpenSSL

  • Loading branch information...
commit ddf0cbb77bff56db0cc78a5f34f0f641fdbcef09 1 parent 9f86179
@drbrain authored
Showing with 9 additions and 4 deletions.
  1. +9 −4 test/test_net_http_persistent_ssl_reuse.rb
View
13 test/test_net_http_persistent_ssl_reuse.rb
@@ -19,7 +19,7 @@ def printf(*args) end
end
def setup
- @name = OpenSSL::X509::Name.parse 'CN=localhost'
+ @name = OpenSSL::X509::Name.parse 'CN=localhost/DC=localdomain'
@key = OpenSSL::PKey::RSA.new 512
@@ -30,6 +30,9 @@ def setup
@cert.not_after = Time.now + 300
@cert.public_key = @key.public_key
@cert.subject = @name
+ @cert.issuer = @name
+
+ @cert.sign @key, OpenSSL::Digest::SHA1.new
@host = 'localhost'
@port = 10082
@@ -73,12 +76,14 @@ def teardown
end
def test_ssl_connection_reuse
+ store = OpenSSL::X509::Store.new
+ store.add_cert @cert
+
@http = Net::HTTP::Persistent::SSLReuse.new @host, @port
+ @http.cert_store = store
+ @http.ssl_version = :SSLv3
@http.use_ssl = true
@http.verify_mode = OpenSSL::SSL::VERIFY_PEER
- @http.verify_callback = proc do |_, store_ctx|
- store_ctx.current_cert.to_der == @cert.to_der
- end
@http.start
@http.get '/'
Please sign in to comment.
Something went wrong with that request. Please try again.