Skip to content

Commit

Permalink
refactoring: code de-duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshi Nakamura committed Feb 3, 2019
1 parent fcbefca commit a5491c7
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/httpclient/jruby_ssl_socket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -552,16 +552,13 @@ def create_ssl_context(config)
def create_ssl_socket(socket, dest, config, opts)
ctx = create_ssl_context(config)
factory = ctx.getSocketFactory
if socket
ssl_socket = factory.createSocket(socket, dest.host, dest.port, true)
else
unless socket
# Create a plain socket first to set connection timeouts on,
# then wrap it in a SSL socket so that SNI gets setup on it.
socket = javax.net.SocketFactory.getDefault.createSocket
JavaSocketWrap.connect(socket, dest, opts)
ssl_socket = factory.createSocket(socket, dest.host, dest.port, true)
end
ssl_socket
factory.createSocket(socket, dest.host, dest.port, true)
end

def peer_cert
Expand Down

0 comments on commit a5491c7

Please sign in to comment.