aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src
diff options
context:
space:
mode:
authorPéter Dimitrov <[email protected]>2018-04-18 16:22:22 +0200
committerPéter Dimitrov <[email protected]>2018-04-23 10:33:08 +0200
commit6f5541f5a734c086e48a70b3f9c2261293893b6a (patch)
treecb7c31b6c1841e53a1b7e11f97a3f00801b2dd15 /lib/inets/src
parent0bcba3f1c9afc9a4164bf78641844a293768a7ec (diff)
downloadotp-6f5541f5a734c086e48a70b3f9c2261293893b6a.tar.gz
otp-6f5541f5a734c086e48a70b3f9c2261293893b6a.tar.bz2
otp-6f5541f5a734c086e48a70b3f9c2261293893b6a.zip
inets: Fix httpd:reload_config/2
- Add proper handling of path() as the first argument to httpd:reload_config/2. Change-Id: Ia5779bdd55bff974e8eb0dd16ef26edf1f52fcff
Diffstat (limited to 'lib/inets/src')
-rw-r--r--lib/inets/src/http_server/httpd.erl29
1 files changed, 23 insertions, 6 deletions
diff --git a/lib/inets/src/http_server/httpd.erl b/lib/inets/src/http_server/httpd.erl
index 540e68e749..1eaa1c930a 100644
--- a/lib/inets/src/http_server/httpd.erl
+++ b/lib/inets/src/http_server/httpd.erl
@@ -36,7 +36,13 @@
]).
%% API
--export([parse_query/1, reload_config/2, info/1, info/2, info/3]).
+-export([
+ parse_query/1,
+ reload_config/2,
+ info/1,
+ info/2,
+ info/3
+ ]).
%%%========================================================================
%%% API
@@ -49,13 +55,24 @@ parse_query(String) ->
reload_config(Config = [Value| _], Mode) when is_tuple(Value) ->
do_reload_config(Config, Mode);
reload_config(ConfigFile, Mode) ->
- case httpd_conf:load(ConfigFile) of
- {ok, ConfigList} ->
- do_reload_config(ConfigList, Mode);
- Error ->
- Error
+ try file:consult(ConfigFile) of
+ {ok, [PropList]} ->
+ %% Erlang terms format
+ do_reload_config(PropList, Mode);
+ {error, _ } ->
+ %% Apache format
+ case httpd_conf:load(ConfigFile) of
+ {ok, ConfigList} ->
+ do_reload_config(ConfigList, Mode);
+ Error ->
+ Error
+ end
+ catch
+ exit:_ ->
+ throw({error, {could_not_consult_proplist_file, ConfigFile}})
end.
+
info(Pid) when is_pid(Pid) ->
info(Pid, []).