From f97ed0ab6ece779d5121822a7d94504daf9bfeb7 Mon Sep 17 00:00:00 2001 From: Michael Ries Date: Sat, 15 Oct 2022 10:49:30 +0100 Subject: [PATCH] allow opting into the no_responders behavior --- lib/gnat/handshake.ex | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/gnat/handshake.ex b/lib/gnat/handshake.ex index a6e7b1f..7e4e302 100644 --- a/lib/gnat/handshake.ex +++ b/lib/gnat/handshake.ex @@ -18,6 +18,7 @@ defmodule Gnat.Handshake do %{verbose: false} |> negotiate_auth(server_settings, user_settings) |> negotiate_headers(server_settings, user_settings) + |> negotiate_no_responders(server_settings, user_settings) end defp perform_handshake(tcp, user_settings) do @@ -77,6 +78,13 @@ defmodule Gnat.Handshake do settings end + defp negotiate_no_responders(%{headers: true} = settings, _server_settings, %{no_responders: true}) do + Map.put(settings, :no_responders, true) + end + defp negotiate_no_responders(settings, _server_settings, _user_settings) do + settings + end + defp upgrade_connection(tcp, %{tls: true, ssl_opts: opts}) do :ok = :inet.setopts(tcp, [active: true]) :ssl.connect(tcp, opts, 1_000)