Skip to content

Commit 4d60d8b

Browse files
authored
Merge pull request #406 from nahi/jruby_socket_refactoring
refactoring: code de-duplication
2 parents fcbefca + a5491c7 commit 4d60d8b

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/httpclient/jruby_ssl_socket.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -552,16 +552,13 @@ def create_ssl_context(config)
552552
def create_ssl_socket(socket, dest, config, opts)
553553
ctx = create_ssl_context(config)
554554
factory = ctx.getSocketFactory
555-
if socket
556-
ssl_socket = factory.createSocket(socket, dest.host, dest.port, true)
557-
else
555+
unless socket
558556
# Create a plain socket first to set connection timeouts on,
559557
# then wrap it in a SSL socket so that SNI gets setup on it.
560558
socket = javax.net.SocketFactory.getDefault.createSocket
561559
JavaSocketWrap.connect(socket, dest, opts)
562-
ssl_socket = factory.createSocket(socket, dest.host, dest.port, true)
563560
end
564-
ssl_socket
561+
factory.createSocket(socket, dest.host, dest.port, true)
565562
end
566563

567564
def peer_cert

0 commit comments

Comments
 (0)