mod_http_upload: Apply cosmetic changes
This commit is contained in:
parent
13e8c857ce
commit
374c1b6dfc
|
@ -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
|
||||
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:
|
||||
|
||||
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
|
||||
|
@ -109,7 +109,7 @@ The configurable mod_http_upload options are:
|
|||
An HTTP GET query such as the following is issued whenever an HTTP upload
|
||||
slot request is accepted as per the 'access' rule:
|
||||
|
||||
http://localhost:5444/?jid=juliet%40example.com&size=10240&name=example.jpg
|
||||
http://localhost:5444/?jid=juliet%40example.com&size=10240&name=example.jpg
|
||||
|
||||
In order to accept the request, the service must return an HTTP status
|
||||
code of 200 or 201 and two lines of text/plain output. The first line is
|
||||
|
|
|
@ -158,7 +158,7 @@ mod_opt_type(max_size) ->
|
|||
(infinity) -> infinity
|
||||
end;
|
||||
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) ->
|
||||
fun(sha1) -> sha1;
|
||||
(node) -> node
|
||||
|
@ -199,7 +199,7 @@ init({ServerHost, Opts}) ->
|
|||
fun(A) when is_atom(A) -> A end,
|
||||
local),
|
||||
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
|
||||
end,
|
||||
104857600),
|
||||
|
@ -227,8 +227,7 @@ init({ServerHost, Opts}) ->
|
|||
ServiceURL = gen_mod:get_opt(service_url, Opts,
|
||||
fun(<<"http://", _/binary>> = URL) -> URL;
|
||||
(<<"https://", _/binary>> = URL) -> URL
|
||||
end,
|
||||
undefined),
|
||||
end),
|
||||
case ServiceURL of
|
||||
undefined ->
|
||||
ok;
|
||||
|
@ -244,7 +243,7 @@ init({ServerHost, Opts}) ->
|
|||
{ok, #state{server_host = ServerHost, host = Host, name = Name,
|
||||
access = Access, max_size = MaxSize,
|
||||
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),
|
||||
get_url = expand_host(str:strip(GetURL, right, $/), ServerHost),
|
||||
service_url = expand_host(ServiceURL, ServerHost)}}.
|
||||
|
|
Loading…
Reference in New Issue