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

captcha_host must have the port number to get protocol (EJAB-1418)

This commit is contained in:
Badlop 2011-03-03 00:05:06 +01:00
parent bf8e09038e
commit 6cc950d76f
3 changed files with 8 additions and 9 deletions

View File

@ -1709,11 +1709,11 @@ The configurable options are:
\titem{\{captcha\_cmd, Path\}}
Full path to a script that generates the image.
The default value is an empty string: \term{""}
\titem{\{captcha\_host, Host\}}
Host part of the URL sent to the user.
You can include the port number.
The URL sent to the user is formed by: \term{http://Host/captcha/}
The default value is the first hostname configured.
\titem{\{captcha\_host, HostPort\}}
Host part of the URL sent to the user,
and the port number where ejabberd listens for CAPTCHA requests.
The URL sent to the user is formed by: \term{http://Host:Port/captcha/}
The default value is: the first hostname configured, and port 5280.
\end{description}
Additionally, an \term{ejabberd\_http} listener must be enabled with the \term{captcha} option.

View File

@ -480,8 +480,7 @@
%%
%%{captcha_cmd, "/lib/ejabberd/priv/bin/captcha.sh"}.
%%
%% Host part of the URL sent to the user.
%% Host for the URL and port where ejabberd listens for CAPTCHA requests.
%%
%%{captcha_host, "example.org:5280"}.

View File

@ -626,12 +626,12 @@ get_prog_name() ->
%% @doc (Str::string()) -> string()
get_url(Str) ->
CaptchaHost = ejabberd_config:get_local_option(captcha_host),
TransferProt = atom_to_list(get_transfer_protocol(CaptchaHost)),
case CaptchaHost of
Host when is_list(Host) ->
TransferProt = atom_to_list(get_transfer_protocol(CaptchaHost)),
TransferProt ++ "://" ++ Host ++ "/captcha/" ++ Str;
_ ->
TransferProt ++ "://" ++ ?MYNAME ++ "/captcha/" ++ Str
"http://" ++ ?MYNAME ++ ":5280/captcha/" ++ Str
end.
get_transfer_protocol(CaptchaHost) ->