mod_http_upload: Log error if 'put_url' is reused

Log a proper [error] message if a single 'put_url' is used for multiple
virtual hosts.
This commit is contained in:
Holger Weiss 2018-09-17 21:46:37 +02:00
parent d5c1174385
commit d2cdfa66f9
1 changed files with 9 additions and 2 deletions

View File

@ -122,7 +122,7 @@
%%--------------------------------------------------------------------
%% gen_mod/supervisor callbacks.
%%--------------------------------------------------------------------
-spec start(binary(), gen_mod:opts()) -> {ok, pid()}.
-spec start(binary(), gen_mod:opts()) -> {ok, pid()} | {error, already_started}.
start(ServerHost, Opts) ->
case gen_mod:get_opt(rm_on_unregister, Opts) of
true ->
@ -132,7 +132,14 @@ start(ServerHost, Opts) ->
ok
end,
Proc = get_proc_name(ServerHost, ?MODULE),
gen_mod:start_child(?MODULE, ServerHost, Opts, Proc).
case whereis(Proc) of
undefined ->
gen_mod:start_child(?MODULE, ServerHost, Opts, Proc);
_Pid ->
?ERROR_MSG("Multiple virtual hosts can't use a single 'put_url' "
"without the @HOST@ keyword", []),
{error, already_started}
end.
-spec stop(binary()) -> ok | {error, any()}.
stop(ServerHost) ->