From 374c1b6dfcf51d5ea62fe5c297f7893f65f81ced Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Sun, 23 Aug 2015 18:06:12 +0200 Subject: [PATCH] mod_http_upload: Apply cosmetic changes --- mod_http_upload/README.txt | 6 +++--- mod_http_upload/src/mod_http_upload.erl | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/mod_http_upload/README.txt b/mod_http_upload/README.txt index 9a300d6..27895f6 100644 --- a/mod_http_upload/README.txt +++ b/mod_http_upload/README.txt @@ -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 diff --git a/mod_http_upload/src/mod_http_upload.erl b/mod_http_upload/src/mod_http_upload.erl index c77a2b5..0d1948b 100644 --- a/mod_http_upload/src/mod_http_upload.erl +++ b/mod_http_upload/src/mod_http_upload.erl @@ -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)}}.