mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-12-29 19:20:46 +08:00
Pass cacerts options to Mint only when SSL (#2449)
This commit is contained in:
parent
0056a81b7f
commit
883c0f39ec
1 changed files with 8 additions and 1 deletions
|
@ -21,7 +21,14 @@ defmodule Livebook.Teams.WebSocket do
|
|||
uri = URI.parse(Livebook.Config.teams_url())
|
||||
{http_scheme, ws_scheme} = parse_scheme(uri)
|
||||
state = %{status: nil, headers: [], body: []}
|
||||
opts = [protocols: [:http1], transport_opts: [cacerts: :public_key.cacerts_get()]]
|
||||
opts = [protocols: [:http1]]
|
||||
|
||||
opts =
|
||||
if http_scheme == :https do
|
||||
put_in(opts[:transport_opts][:cacerts], :public_key.cacerts_get())
|
||||
else
|
||||
opts
|
||||
end
|
||||
|
||||
with {:ok, conn} <- Mint.HTTP.connect(http_scheme, uri.host, uri.port, opts),
|
||||
{:ok, conn, ref} <- Mint.WebSocket.upgrade(ws_scheme, conn, @ws_path, headers) do
|
||||
|
|
Loading…
Reference in a new issue