I am trying to make a :hackney_ssl
connection to a host via a proxy.
This works:
:hackney_ssl.connect('www.example.com', 443, [])
And returns:
{:ok, {:sslsocket, {:gen_tcp, #Port<0.66>, :tls_connection, :undefined}, [#PID<0.593.0>, #PID<0.592.0>]}}
But when I add proxy options, I get an options error:
with charlists:
:hackney_ssl.connect('www.example.com', 443, proxy: {'192.41.71.221', 3128})
with binaries:
:hackney_ssl.connect('www.example.com', 443, proxy: {"192.41.71.221", 3128})
in a list with the option in a tuple and the proxy url in a charlist:
:hackney_ssl.connect('www.example.com', 443, [{:proxy, {'192.41.71.221', 3128}}])
in a list with the option in a tuple and the proxy url in a binary:
:hackney_ssl.connect('www.example.com', 443, [{:proxy, {"192.41.71.221", 3128}}])
All of these end up with some version of
{:error, {:options, {:socket_options, [ proxy: {'104.45.188.43', 3128}, packet_size: 0, packet: 0, header: 0, active: false, mode: :binary ]}}}
It appears that the proxy
option isn’t available with hackney_ssl
, or at least I am doing it wrong. Ultimately, I want to connect to a host via a proxy connection and use the :sslsocket
to get the certificate. It works without the proxy option.
Can I get an :sslsocket
without hackney_ssl
, maybe via a standard :hackney.get()
or :hackney.request()
?