A VHost is a binary, so we can guard against it without

resorting to [{_K,_V}|_T] magic.

Also, in start/6 don't try to verify the ssl options passed in
leave that to the ssl library itself
This commit is contained in:
Essien Ita Essien 2009-01-13 15:57:53 +01:00
parent 189d1d62d1
commit f18b909d70
1 changed files with 5 additions and 14 deletions

View File

@ -54,12 +54,12 @@ start(User, Password, ProcLink) when is_boolean(ProcLink) ->
start(User, Password, Host) ->
start(User, Password, Host, <<"/">>, false).
start(User, Password, Host, SslOpts=[{_K,_V}|_T]) ->
start(User, Password, Host, SslOpts) when is_list(SslOpts) ->
start(User,Password,Host,<<"/">>,SslOpts,false);
start(User, Password, Host, VHost) ->
start(User, Password, Host, VHost) when is_binary(VHost) ->
start(User, Password, Host, VHost, false).
start(User, Password, Host, VHost, SslOpts=[{_K,_V}|_T]) ->
start(User, Password, Host, VHost, SslOpts) when is_list(SslOpts) ->
start(User, Password, Host, VHost, SslOpts, false);
start(User, Password, Host, VHost, ProcLink) ->
InitialState = #connection_state{username = User,
@ -68,24 +68,15 @@ start(User, Password, Host, VHost, ProcLink) ->
vhostpath = VHost},
{ok, Pid} = start_internal(InitialState, amqp_network_driver, ProcLink),
Pid.
start(User,Password,Host,VHost,SslOpts=[{_K,_V}|_T], ProcLink) ->
{cacertfile, Cacertfile} = proplists:lookup(cacertfile, SslOpts),
{certfile, Certfile} = proplists:lookup(certfile, SslOpts),
{keyfile, Keyfile} = proplists:lookup(keyfile, SslOpts),
start(User, Password, Host, VHost, SslOpts, ProcLink) when is_list(SslOpts) ->
InitialState = #connection_state{username = User,
password = Password,
serverhost = Host,
vhostpath = VHost,
sslopts=[
{cacertfile, Cacertfile},
{certfile, Certfile},
{keyfile, Keyfile}]},
sslopts=SslOpts},
{ok, Pid} = start_internal(InitialState, amqp_network_driver, ProcLink),
Pid.
start_link(User, Password) ->
start(User, Password, true).