dvadell1
:ssl.connect() always returns :socket_options error!
Hi!
What is the right way of calling the :ssl.connect() ? From Erlang -- Using SSL application API it looks like it should be:
:ssl.start()
:ssl.connect("google.com", 443, [{:verify, :verify_peer},{:cacerts, :public_key.cacerts_get()}])
But no matter what host or options I try, I get the same:
Interactive Elixir (1.14.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :ssl.start()
:ok
iex(2)> :ssl.connect("google.com", 443, [{:verify, :verify_peer}, {:cacerts, :public_key.cacerts_get()} ])
{:error,
{:options,
{:socket_options,
[packet_size: 0, packet: 0, header: 0, active: false, mode: :binary]}}}
Does anyone know what am I doing wrong?
Thanks!
Marked As Solved
kip
ex_cldr Core Team
Since :ssl is an erlang lib I expect you would need to put the URL in single quotes for Elixir, like 'google.com'. That may not be the source of the error you are seeing but it might help.
1
Also Liked
benwilson512
Author of Craft GraphQL APIs in Elixir with Absinthe
Yup
iex(3)> :ssl.connect("google.com", 443, [{:verify, :verify_peer},{:cacerts, :public_key.cacerts_get()}])
{:error,
{:options,
{:socket_options,
[packet_size: 0, packet: 0, header: 0, active: false, mode: :binary]}}}
iex(4)> :ssl.connect('google.com', 443, [{:verify, :verify_peer},{:cacerts, :public_key.cacerts_get()}])
{:ok,
{:sslsocket, {:gen_tcp, #Port<0.7>, :tls_connection, :undefined},
[#PID<0.244.0>, #PID<0.243.0>]}}
It’s a common gotcha when transliterating code from Erlang to Elixir.
2
dvadell1
Thanks!! That was exactly it! ![]()
1
Popular in Questions
What is the proper way to load a module from a file in to IEX?
In the python world, doing something like this pretty standard:
from ....
New
Hi all,
Trying to get some more clarity over utc_datetime and naive_datetime for Ecto:
https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
I have followed this StackOverflow post to install the specific version of Erlang.
And When I am running mix ecto.setup then getting fol...
New
Hi, I’m using Ubuntu 18.04 and after updating to OTP-24.0 yesterday i have this warning when I run “mix local.hex”:
14:57:30.512 [warn] ...
New
Hey guys.
I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size?
Thanks
New
In AR this is so simple
@articles = current_user.articles
How to do in Ecto?
def index(conn, _params) do
current_user = conn.assig...
New
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
Other popular topics
Hello!
tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability.
After spen...
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
New
Hi folks,
Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
New
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set?
Thanks.
New
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
Hey all,
I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
Hi everyone,
One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New







