aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_ssl_transport.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-02-20 08:47:00 +0100
committerLoïc Hoguin <[email protected]>2012-02-20 08:48:06 +0100
commit811d11a1a28e9d044cb328d62e3c01bb3c536fb5 (patch)
tree32967c575a6cdbe20f4d08fb67aec1a927e8eb13 /src/cowboy_ssl_transport.erl
parent9baf3e2ae91a2e541780e72b556ee98de6550193 (diff)
parente67d839154a0c031e667903da013a4a49be86ced (diff)
downloadcowboy-811d11a1a28e9d044cb328d62e3c01bb3c536fb5.tar.gz
cowboy-811d11a1a28e9d044cb328d62e3c01bb3c536fb5.tar.bz2
cowboy-811d11a1a28e9d044cb328d62e3c01bb3c536fb5.zip
Merge branch 'ssl-password-cacert' of https://github.com/DeadZen/cowboy
Diffstat (limited to 'src/cowboy_ssl_transport.erl')
-rw-r--r--src/cowboy_ssl_transport.erl17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/cowboy_ssl_transport.erl b/src/cowboy_ssl_transport.erl
index bf8b1fb..8eaf320 100644
--- a/src/cowboy_ssl_transport.erl
+++ b/src/cowboy_ssl_transport.erl
@@ -68,21 +68,30 @@ listen(Opts) ->
{port, Port} = lists:keyfind(port, 1, Opts),
Backlog = proplists:get_value(backlog, Opts, 1024),
{certfile, CertFile} = lists:keyfind(certfile, 1, Opts),
- {keyfile, KeyFile} = lists:keyfind(keyfile, 1, Opts),
- {password, Password} = lists:keyfind(password, 1, Opts),
+ KeyFileOpts =
+ case lists:keyfind(keyfile, 1, Opts) of
+ false -> [];
+ KeyFile -> [KeyFile]
+ end,
+ PasswordOpts =
+ case lists:keyfind(password, 1, Opts) of
+ false -> [];
+ Password -> [Password]
+ end,
ListenOpts0 = [binary, {active, false},
{backlog, Backlog}, {packet, raw}, {reuseaddr, true},
- {certfile, CertFile}, {keyfile, KeyFile}, {password, Password}],
+ {certfile, CertFile}],
ListenOpts1 =
case lists:keyfind(ip, 1, Opts) of
false -> ListenOpts0;
Ip -> [Ip|ListenOpts0]
end,
- ListenOpts =
+ ListenOpts2 =
case lists:keyfind(cacertfile, 1, Opts) of
false -> ListenOpts1;
CACertFile -> [CACertFile|ListenOpts1]
end,
+ ListenOpts = ListenOpts2 ++ KeyFileOpts ++ PasswordOpts,
ssl:listen(Port, ListenOpts).
%% @doc Accept an incoming connection on a listen socket.