From c74d53af61639b478032d0955c829b103fba294c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 20 Jun 2013 15:15:14 +0200 Subject: Add asn1 to the list of applications that need to be started for SSL --- guide/transports.md | 7 ++++--- src/ranch_ssl.erl | 11 ++++++----- test/acceptor_SUITE.erl | 2 ++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/guide/transports.md b/guide/transports.md index 910d3ce..1844ac9 100644 --- a/guide/transports.md +++ b/guide/transports.md @@ -20,9 +20,10 @@ SSL transport ------------- The SSL transport is a thin wrapper around `ssl`. It requires -the `crypto`, `public_key` and `ssl` applications to be started. -You can start each of them individually, or you can call the -`ssl:start/0` convenience function. +the `crypto`, `asn1`, `public_key` and `ssl` applications +to be started. When starting an SSL listener, Ranch will attempt +to automatically start them. It will not try to stop them when +the listener is removed, however. ``` erlang ssl:start(). diff --git a/src/ranch_ssl.erl b/src/ranch_ssl.erl index 4129f18..512f3b4 100644 --- a/src/ranch_ssl.erl +++ b/src/ranch_ssl.erl @@ -16,10 +16,11 @@ %% %% Wrapper around ssl implementing the Ranch transport API. %% -%% This transport requires the crypto, public_key -%% and ssl applications to be started. If they aren't started, -%% it will try to start them itself before opening a port to listen. -%% Applications aren't stopped when the listening socket is closed, though. +%% This transport requires the crypto, asn1, +%% public_key and ssl applications to be started. +%% If they aren't started, it will try to start them itself before +%% opening a port to listen. Applications aren't stopped when the +%% listening socket is closed, though. %% %% @see ssl -module(ranch_ssl). @@ -131,7 +132,7 @@ messages() -> {ssl, ssl_closed, ssl_error}. %% @see ssl:listen/2 -spec listen(opts()) -> {ok, ssl:sslsocket()} | {error, atom()}. listen(Opts) -> - ranch:require([crypto, public_key, ssl]), + ranch:require([crypto, asn1, public_key, ssl]), true = lists:keymember(cert, 1, Opts) orelse lists:keymember(certfile, 1, Opts), Opts2 = ranch:set_option_default(Opts, backlog, 1024), diff --git a/test/acceptor_SUITE.erl b/test/acceptor_SUITE.erl index 0ab6652..f4789c8 100644 --- a/test/acceptor_SUITE.erl +++ b/test/acceptor_SUITE.erl @@ -92,6 +92,7 @@ end_per_suite(_) -> init_per_group(ssl, Config) -> application:start(crypto), + application:start(asn1), application:start(public_key), application:start(ssl), Config; @@ -101,6 +102,7 @@ init_per_group(_, Config) -> end_per_group(ssl, _) -> application:stop(ssl), application:stop(public_key), + application:stop(asn1), application:stop(crypto), ok; end_per_group(_, _) -> -- cgit v1.2.3