elixir-mint / mint

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

Messages not recognized when using proxy #371

Closed ppatrzyk closed 2 years ago

ppatrzyk commented 2 years ago

Function is_connection_message/2 seems to fail when proxy is being used. Minimal example:

require Mint.HTTP
require Logger

opts = [proxy: {:http, "localhost", 8118, []}]
{:ok, conn} = Mint.HTTP.connect(:http, "httpbin.org", 80, opts)
{:ok, conn, request_ref} = Mint.HTTP.request(conn, "GET", "/json", [], "")

receive do
  msg ->
    is_ok = Mint.HTTP.is_connection_message(conn, msg)
    is_ok |> inspect() |> Logger.warn()
    msg |> inspect() |> Logger.warn()
end

I see output that message is not related to the connection - this is incorrect. Changing opts to empty list (i.e., connection without proxy) fixes the issue.

Details: