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
Hi! May someone helps me, please!
I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
Hello!
Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
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
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
I would like to know what is the best IDE for elixir development?
New
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible.
total = 10
while total != 0
...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
Hi guys, nice to meet you to the whole forum, I’m new here, I’m trying to configure visual studio code for elixir, right now the intellis...
New
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
Other popular topics
Hi! May someone helps me, please!
I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
Manning 2016 Halloween weekend sale via Deal of the Day
Friday, October 28 - Half off all MEAPs - code WM102816LT
Saturday, October 29 ...
New
The Elixir Typespec docs show the following syntax for keyword lists in typespecs:
# ...
| [key: type] # keyword lis...
New
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
I will often find my self writing things similar to:
case some_value do
nil -> something()
"" -> something()
_ -> someth...
New
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including.
What is Phoenix LiveV...
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New







