Closed prodis closed 4 years ago
Works fine.
1> application:ensure_all_started(gun).
{ok,[crypto,asn1,public_key,ssl,cowlib,gun]}
2> {ok, Pid} = gun:open("apps.correios.com.br", 443, #{tls_opts => [{ciphers, ["AES256-SHA256"]}, {versions, ['tlsv1.2']}]}).
{ok,<0.110.0>}
3> gun:await_up(Pid).
{ok,http}
Gun does not make TLS work magically out of the box for you, and due to the transition to TLS 1.3 there's no configuration that works everywhere right now anyway.
Thanks for the explanation. I suppose your example is using version 2.0.0-pre.2 and not 1.3.2.
An example in Elixir to be used as a self-reference:
iex(1)> {:ok, conn} = :gun.open('apps.correios.com.br', 443, %{tls_opts: [ciphers: ['AES256-SHA256'], versions: [:"tlsv1.2"]]})
{:ok, #PID<0.273.0>}
iex(2)> :gun.await_up(conn)
{:ok, :http}
Yes.
It is not possible to connect to the host
apps.correios.com.br
with SSL. Viacurl
works fine.Gun
Curl
Using other Elixir/Erlang HTTP clients
Similar problem happens with
Mint
,httpc
,ibrowse
, andhackney
with proxy, but it works fine usinghackney
without proxy. See this issue in hackney and this issue in Mint for more details.Integration tests
I created some tests to run in Travis CI using different versions of Elixir and OTP: https://github.com/prodis/correios-cep-elixir/blob/a18b1536d9651bee24b9edd5b35df3c5912baed1/test/integration/gun_test.exs
Results in Travis: https://travis-ci.org/github/prodis/correios-cep-elixir/builds/682440205
My system info