Hello. I am trying to understand and fix an error I am receiveing when trying to retrieve the ssl certificate from an ssl handshake. Any handshake action that returns anything other than a 200 status code results in the following error:
TLS :client: In state :hello at tls_record.erl:471 generated CLIENT ALERT: Fatal - Unexpected Message
.
I would like to retrieve the certificate regardless of the response code. Here is how I initiate the handshake. FYI, I am issuing the request through a proxy.
{:ok, tcp} = :gen_tcp.connect('#{proxy_ip}', proxy_port, active: false)
:gen_tcp.send(tcp, "CONNECT #{host_name}:443 HTTP/1.1\r\nProxy-Authorization: Basic #{:base64.encode_to_string('#{proxy_uername}:#{proxy_password}')}\r\n\r\n")
ssl_options = [
versions: [:"tlsv1.2"],
server_name_indication: '#{host_name}',
verify: :verify_none,
depth: 3,
reuse_sessions: false
]
recv = :gen_tcp.recv(tcp, 0, 5000)
:ssl.start()
:ssl.connect(tcp, ssl_options, timeout)
Is there anything that jumps out here as an obviouse possible issue with how I am making the request?
Thank you