diff options
-rw-r--r-- | src/cowboy_ssl_transport.erl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cowboy_ssl_transport.erl b/src/cowboy_ssl_transport.erl index cbe1ac1..bafa99b 100644 --- a/src/cowboy_ssl_transport.erl +++ b/src/cowboy_ssl_transport.erl @@ -30,6 +30,7 @@ messages() -> {ssl, ssl_closed, ssl_error}. | {keyfile, KeyPath::string()} | {password, Password::string()}]) -> {ok, LSocket::ssl:sslsocket()} | {error, Reason::atom()}. listen(Opts) -> + require([crypto, public_key, ssl]), {port, Port} = lists:keyfind(port, 1, Opts), Backlog = proplists:get_value(backlog, Opts, 1024), {certfile, CertFile} = lists:keyfind(certfile, 1, Opts), @@ -80,6 +81,16 @@ close(Socket) -> %% Internal. +-spec require(Apps::list(module())) -> ok. +require([]) -> + ok; +require([App|Tail]) -> + case application:start(App) of + ok -> ok; + {error, {already_started, App}} -> ok + end, + require(Tail). + -spec ssl_accept(CSocket::ssl:sslsocket(), Timeout::timeout()) -> {ok, Socket::ssl:sslsocket()} | {error, Reason::closed | timeout | atom()}. ssl_accept(CSocket, Timeout) -> |