mod_http_upload: Apply cosmetic changes

This commit is contained in:
Holger Weiss 2015-08-23 18:06:12 +02:00
parent 13e8c857ce
commit 374c1b6dfc
2 changed files with 7 additions and 8 deletions

View File

@ -15,11 +15,11 @@ the file and another URL from which that file can later be downloaded.
PLEASE NOTE: This module implements an experimental protocol which has NOT PLEASE NOTE: This module implements an experimental protocol which has NOT
been approved by the XMPP Standards Foundation and may change at any time: been approved by the XMPP Standards Foundation and may change at any time:
http://xmpp.org/extensions/inbox/http-upload.html http://xmpp.org/extensions/inbox/http-upload.html
There are already suggestions for improvements, e.g. from ProcessOne: There are already suggestions for improvements, e.g. from ProcessOne:
https://github.com/processone/ejabberd-saas-docs/blob/master/xmpp-specs/http-filetransfer/http-filetransfer.md https://github.com/processone/ejabberd-saas-docs/blob/master/xmpp-specs/http-filetransfer/http-filetransfer.md
CONFIGURATION CONFIGURATION

View File

@ -158,7 +158,7 @@ mod_opt_type(max_size) ->
(infinity) -> infinity (infinity) -> infinity
end; end;
mod_opt_type(secret_length) -> mod_opt_type(secret_length) ->
fun (I) when is_integer(I), I >= 8-> I end; fun(I) when is_integer(I), I >= 8 -> I end;
mod_opt_type(jid_in_url) -> mod_opt_type(jid_in_url) ->
fun(sha1) -> sha1; fun(sha1) -> sha1;
(node) -> node (node) -> node
@ -199,7 +199,7 @@ init({ServerHost, Opts}) ->
fun(A) when is_atom(A) -> A end, fun(A) when is_atom(A) -> A end,
local), local),
MaxSize = gen_mod:get_opt(max_size, Opts, MaxSize = gen_mod:get_opt(max_size, Opts,
fun (I) when is_integer(I), I > 0 -> I; fun(I) when is_integer(I), I > 0 -> I;
(infinity) -> infinity (infinity) -> infinity
end, end,
104857600), 104857600),
@ -227,8 +227,7 @@ init({ServerHost, Opts}) ->
ServiceURL = gen_mod:get_opt(service_url, Opts, ServiceURL = gen_mod:get_opt(service_url, Opts,
fun(<<"http://", _/binary>> = URL) -> URL; fun(<<"http://", _/binary>> = URL) -> URL;
(<<"https://", _/binary>> = URL) -> URL (<<"https://", _/binary>> = URL) -> URL
end, end),
undefined),
case ServiceURL of case ServiceURL of
undefined -> undefined ->
ok; ok;
@ -244,7 +243,7 @@ init({ServerHost, Opts}) ->
{ok, #state{server_host = ServerHost, host = Host, name = Name, {ok, #state{server_host = ServerHost, host = Host, name = Name,
access = Access, max_size = MaxSize, access = Access, max_size = MaxSize,
secret_length = SecretLength, jid_in_url = JIDinURL, secret_length = SecretLength, jid_in_url = JIDinURL,
docroot = expand_home(DocRoot), docroot = expand_home(str:strip(DocRoot, right, $/)),
put_url = expand_host(str:strip(PutURL, right, $/), ServerHost), put_url = expand_host(str:strip(PutURL, right, $/), ServerHost),
get_url = expand_host(str:strip(GetURL, right, $/), ServerHost), get_url = expand_host(str:strip(GetURL, right, $/), ServerHost),
service_url = expand_host(ServiceURL, ServerHost)}}. service_url = expand_host(ServiceURL, ServerHost)}}.