Skip to content

Commit 6ef0f9b

Browse files
dspencer001benoitc
authored andcommitted
Send SNI for erlang >= 17 (#455)
* send sni for erlang >= 17 * Fix bad regex
1 parent 5b51fb8 commit 6ef0f9b

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

rebar.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
{erl_opts, [debug_info,
55
{platform_define, "R14", no_callback_support},
6-
{platform_define, "^[0-9]+", namespaced_types}
6+
{platform_define, "^[0-9]+", namespaced_types},
7+
{platform_define, "^R", no_proxy_sni_support}
78
]}.
89

910
{xref_checks, [undefined_function_calls]}.

src/hackney_http_connect.erl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@
2424
-type http_socket() :: {atom(), inet:socket()}.
2525
-export_type([http_socket/0]).
2626

27+
-ifdef(no_proxy_sni_support).
28+
29+
ssl_opts(Host, Opts) ->
30+
hackney_connect:ssl_opts(Host, Opts).
31+
32+
-else.
33+
34+
ssl_opts(Host, Opts) ->
35+
[{server_name_indication, Host} | hackney_connect:ssl_opts(Host,Opts)].
36+
37+
-endif.
38+
2739
%% @doc Atoms used to identify messages in {active, once | true} mode.
2840
messages({hackney_ssl, _}) ->
2941
{ssl, ssl_closed, ssl_error};
@@ -59,7 +71,7 @@ connect(ProxyHost, ProxyPort, Opts, Timeout)
5971
%% upgrade the connection socket to handle SSL.
6072
case Transport of
6173
hackney_ssl ->
62-
SSLOpts = hackney_connect:ssl_opts(Host, Opts),
74+
SSLOpts = ssl_opts(Host, Opts),
6375
%% upgrade the tcp connection
6476
case ssl:connect(Socket, SSLOpts) of
6577
{ok, SslSocket} ->

0 commit comments

Comments
 (0)