Skip to content

Commit

Permalink
Merge pull request #363 from dgolombek/wip/sni_fix
Browse files Browse the repository at this point in the history
Fix SNI handling for JRuby
  • Loading branch information
nahi authored Feb 3, 2019
2 parents 5cfed97 + 091b711 commit fcbefca
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/httpclient/jruby_ssl_socket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,11 @@ def create_ssl_socket(socket, dest, config, opts)
if socket
ssl_socket = factory.createSocket(socket, dest.host, dest.port, true)
else
ssl_socket = factory.createSocket
JavaSocketWrap.connect(ssl_socket, dest, opts)
# 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
end
Expand Down

0 comments on commit fcbefca

Please sign in to comment.