elixir-mint / mint

Functional HTTP client for Elixir with support for HTTP/1 and HTTP/2 🌱
Apache License 2.0
1.36k stars 106 forks source link

Process receives additional messages when using HTTPS/SSL #378

Closed interacsion closed 1 year ago

interacsion commented 1 year ago

So I am following the usage example but with https, and my process seems to sometimes receive messages that don't belong to any request. for example, by just opening a connection and sending a single request, my process receives two messages when I only expect one.

whatyouhide commented 1 year ago

@MaiTheLord what are the messages you're receiving? Note that you should not necessarily expect one in general, since responses to request could be split up into multiple TCP packets.

interacsion commented 1 year ago

I am getting messages that look like this: {:ssl, {:sslsocket, {:gen_tcp, #Port<0.5>, :tls_connection, :undefined}, [#PID<0.242.0>, #PID<0.241.0>]}, <<some bytes>>}

The README doesn't make it clear that the response to a request can be split into multiple messages though, maybe that should be looked into

whatyouhide commented 1 year ago

@MaiTheLord those are expected SSL messages. In general, you should not care about the content of those messages, and instead forward them to Mint.Conn.stream/2.

In any case, I added this note to the README 👍