https://hexdocs.pm/curl_ex/readme.html
Motivation
I got frustrated with Unknown CA errors from Erlang. Meanwhile, curl
works just fine with the sites in question:
I get this error with both :httpc and HTTPoison.get. Here’s HTTPoison:
iex(1)> HTTPoison.get! "https://grad.tamu.edu/"
22:15:54.179 [notice] TLS :client: In state :certify at ssl_handshake.erl:2138 generated CLIENT ALERT: Fatal - Unknown CA
** (HTTPoison.Error) {:tls_alert, {:unknown_ca, ~c"TLS client: In state certify at ssl_handshake.erl:2138 generated CLIENT ALERT: Fatal - Unknown CA\n"}}
(httpoison 2.2.0) lib/httpoison/base.ex:451: HTTPoison.request!/5
iex:1: (file)
Same with thi…
I couldn’t find a working Elixir lib that uses curl
. So I started this ultra-simple and naive (but tested) one.
Usage
iex(1)> CurlEx.get!("https://google.com")
"<html>...</html>"
Currently, Microsoft Edge / Windows is the supported custom User Agent:
iex(2)> CurlEx.get_with_user_agent!("https://google.com", :microsoft_edge_windows)
"<html>...</html>"
4 Likes
kwando
November 22, 2023, 7:22am
2
Try req
. req | Hex
Req.get("https://grad.tamu.edu/")
works fine over here.
1 Like
voltone
November 22, 2023, 9:45am
3
That’s because the server has since been reconfigured to send the missing intermediate CA. (curl
fetches missing intermediate CA certificates using the URL in the AIA extension, but Erlang’s ssl
does not, also when using Mint/req)
4 Likes
kwando
November 22, 2023, 10:01am
4
okay, good they got that reconfigured
1 Like
Yep!
Pretty nice—they acted on it.