25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Merge pull request #387 from weiss/fix-captcha-without-proto

Fix ejabberd_captcha's listener parsing
This commit is contained in:
Evgeny Khramtsov 2014-12-24 19:16:02 +03:00
commit 173d9761ca

View File

@ -549,10 +549,11 @@ get_transfer_protocol(PortString) ->
get_port_listeners(PortNumber) -> get_port_listeners(PortNumber) ->
AllListeners = ejabberd_config:get_option(listen, fun(V) -> V end), AllListeners = ejabberd_config:get_option(listen, fun(V) -> V end),
lists:filter(fun ({{Port, _Ip, _Netp}, _Module1, lists:filter(fun (Listener) when is_list(Listener) ->
_Opts1}) case proplists:get_value(port, Listener) of
when Port == PortNumber -> PortNumber -> true;
true; _ -> false
end;
(_) -> false (_) -> false
end, end,
AllListeners). AllListeners).
@ -562,12 +563,11 @@ get_captcha_transfer_protocol([]) ->
"is not a ejabberd_http listener with " "is not a ejabberd_http listener with "
"'captcha' option. Change the port number " "'captcha' option. Change the port number "
"or specify http:// in that option.">>); "or specify http:// in that option.">>);
get_captcha_transfer_protocol([{{_Port, _Ip, tcp}, get_captcha_transfer_protocol([Listener | Listeners]) when is_list(Listener) ->
ejabberd_http, Opts} case proplists:get_value(module, Listener) == ejabberd_http andalso
| Listeners]) -> proplists:get_bool(captcha, Listener) of
case lists:member(captcha, Opts) of
true -> true ->
case lists:member(tls, Opts) of case proplists:get_bool(tls, Listener) of
true -> https; true -> https;
false -> http false -> http
end; end;