Skip to content

Commit

Permalink
fix: fast fail on invalid ssl options
Browse files Browse the repository at this point in the history
  • Loading branch information
terry-xiaoyu committed Mar 12, 2024
1 parent d596cff commit a175bfa
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/esockd.app.src
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{application, esockd,
[{description, "General Non-blocking TCP/SSL and UDP/DTLS Server"},
{id, "esockd"},
{vsn, "5.8.11"},
{vsn, "5.8.12"},
{modules, []},
{registered, []},
{applications, [kernel, stdlib, sasl, ssl]},
Expand Down
24 changes: 19 additions & 5 deletions src/esockd.appup.src
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
%%-*- mode: erlang; -*-

{"5.8.10",
[{"5.8.10",
[{load_module,esockd_transport,brutal_purge,soft_purge,[]}]},
{"5.8.12",
[{"5.8.11",
[{load_module,esockd_listener_sup,brutal_purge,soft_purge,[]}]},
{"5.8.10",
[{load_module,esockd_listener_sup,brutal_purge,soft_purge,[]},
{load_module,esockd_transport,brutal_purge,soft_purge,[]}]},
{<<"5\\.8\\.[6-9]">>,
[{add_module,esockd_utils},
{load_module,esockd_listener_sup,brutal_purge,soft_purge,[]},
{load_module,esockd_transport,brutal_purge,soft_purge,[]},
{load_module,esockd_acceptor,brutal_purge,soft_purge,[]},
{load_module,esockd_proxy_protocol,brutal_purge,soft_purge,[]}
]},
{<<"5\\.8\\.[4-5]">>,
[{add_module,esockd_utils},
{load_module,esockd_listener_sup,brutal_purge,soft_purge,[]},
{load_module,esockd_udp,brutal_purge,soft_purge,[]},
{load_module,esockd_acceptor,brutal_purge,soft_purge,[]},
{load_module,esockd_proxy_protocol,brutal_purge,soft_purge,[]},
{load_module,esockd_transport,brutal_purge,soft_purge,[]}
]},
{"5.8.3",
[{add_module,esockd_utils},
{load_module,esockd_listener_sup,brutal_purge,soft_purge,[]},
{load_module,esockd_udp,brutal_purge,soft_purge,[]},
{load_module,esockd_acceptor,brutal_purge,soft_purge,[]},
{load_module,esockd_proxy_protocol,brutal_purge,soft_purge,[]},
Expand All @@ -26,6 +32,7 @@
]},
{<<"5\\.8\\.[0-2]">>,
[{add_module,esockd_utils},
{load_module,esockd_listener_sup,brutal_purge,soft_purge,[]},
{load_module,esockd_udp,brutal_purge,soft_purge,[]},
{load_module,esockd_acceptor,brutal_purge,soft_purge,[]},
{load_module,esockd_proxy_protocol,brutal_purge,soft_purge,[]},
Expand All @@ -37,23 +44,29 @@
]},
{<<".*">>, []}
],
[{"5.8.10",
[{load_module,esockd_transport,brutal_purge,soft_purge,[]}]},
[{"5.8.11",
[{load_module,esockd_listener_sup,brutal_purge,soft_purge,[]}]},
{"5.8.10",
[{load_module,esockd_listener_sup,brutal_purge,soft_purge,[]},
{load_module,esockd_transport,brutal_purge,soft_purge,[]}]},
{<<"5\\.8\\.[6-9]">>,
[{load_module,esockd_transport,brutal_purge,soft_purge,[]},
{load_module,esockd_listener_sup,brutal_purge,soft_purge,[]},
{load_module,esockd_acceptor,brutal_purge,soft_purge,[]},
{load_module,esockd_proxy_protocol,brutal_purge,soft_purge,[]},
{delete_module,esockd_utils}
]},
{<<"5\\.8\\.[4-5]">>,
[{load_module,esockd_udp,brutal_purge,soft_purge,[]},
{load_module,esockd_listener_sup,brutal_purge,soft_purge,[]},
{load_module,esockd_acceptor,brutal_purge,soft_purge,[]},
{load_module,esockd_proxy_protocol,brutal_purge,soft_purge,[]},
{load_module,esockd_transport,brutal_purge,soft_purge,[]},
{delete_module,esockd_utils}
]},
{"5.8.3",
[{load_module,esockd_udp,brutal_purge,soft_purge,[]},
{load_module,esockd_listener_sup,brutal_purge,soft_purge,[]},
{load_module,esockd_acceptor,brutal_purge,soft_purge,[]},
{load_module,esockd_proxy_protocol,brutal_purge,soft_purge,[]},
{load_module,esockd_limiter, brutal_purge, soft_purge, []},
Expand All @@ -62,6 +75,7 @@
]},
{<<"5\\.8\\.[0-2]">>,
[{load_module,esockd_udp,brutal_purge,soft_purge,[]},
{load_module,esockd_listener_sup,brutal_purge,soft_purge,[]},
{load_module,esockd_acceptor,brutal_purge,soft_purge,[]},
{load_module,esockd_proxy_protocol,brutal_purge,soft_purge,[]},
{load_module,esockd_connection_sup,brutal_purge,soft_purge,[]},
Expand Down
5 changes: 4 additions & 1 deletion src/esockd_listener_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,10 @@ ssl_upgrade_fun(Type, Opts) ->
end,
case proplists:get_value(Key, Opts) of
undefined -> [];
SslOpts -> [esockd_transport:ssl_upgrade_fun(SslOpts)]
SslOpts ->
%% validate ssl options here
_ = ssl:handle_options(SslOpts, server),
[esockd_transport:ssl_upgrade_fun(SslOpts)]
end.

conn_rate_opt(Opts) ->
Expand Down

0 comments on commit a175bfa

Please sign in to comment.