From 6f08e772693d3b45da3b548404a56be1c88ec2da Mon Sep 17 00:00:00 2001 From: Alex S Date: Tue, 20 Aug 2019 18:06:08 +0300 Subject: [PATCH] sni option if we open connection in gun pool --- lib/pleroma/gun/connections.ex | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/pleroma/gun/connections.ex b/lib/pleroma/gun/connections.ex index 5b0605026..3716d9f74 100644 --- a/lib/pleroma/gun/connections.ex +++ b/lib/pleroma/gun/connections.ex @@ -36,6 +36,19 @@ defmodule Pleroma.Gun.Connections do do: Map.put(opts, :transport, :tls), else: opts + opts = + if uri.scheme == "https" do + host = uri.host |> to_charlist() + + tls_opts = + Map.get(opts, :tls_opts, []) + |> Keyword.put(:server_name_indication, host) + + Map.put(opts, :tls_opts, tls_opts) + else + opts + end + GenServer.call( name, {:conn, %{opts: opts, uri: uri}}