aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex S <alex.strizhakov@gmail.com>2019-08-20 18:06:08 +0300
committerAlex S <alex.strizhakov@gmail.com>2019-08-20 18:06:08 +0300
commit6f08e772693d3b45da3b548404a56be1c88ec2da (patch)
tree9d10d0f063c5363b4a1ea6502e93b35be0a7f240
parent50bc6c5ea98494ceeda7cdb18d75defe485d9a64 (diff)
downloadpleroma-6f08e772693d3b45da3b548404a56be1c88ec2da.tar.gz
sni option if we open connection in gun pool
-rw-r--r--lib/pleroma/gun/connections.ex13
1 files changed, 13 insertions, 0 deletions
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}}