We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6071f18 commit 1f5ee7dCopy full SHA for 1f5ee7d
lib/mongo/mongo_db_connection.ex
@@ -164,7 +164,13 @@ defmodule Mongo.MongoDBConnection do
164
165
defp ssl(opts, %{connection: {:gen_tcp, socket}} = state) do
166
host = (opts[:hostname] || "localhost") |> to_charlist
167
- ssl_opts = Keyword.put_new(opts[:ssl_opts] || [], :server_name_indication, host)
+
168
+ # Do not set SNI for IP addresses
169
+ ssl_opts =
170
+ case :inet.parse_address(host) do
171
+ {:ok, _} -> opts[:ssl_opts]
172
+ _ -> Keyword.put_new(opts[:ssl_opts] || [], :server_name_indication, host)
173
+ end
174
175
case :ssl.connect(socket, ssl_opts, state.connect_timeout) do
176
{:ok, ssl_sock} ->
0 commit comments