diff options
author | Péter Dimitrov <[email protected]> | 2018-04-24 10:49:58 +0200 |
---|---|---|
committer | Péter Dimitrov <[email protected]> | 2018-04-24 10:49:58 +0200 |
commit | 2e439788218f4f81e9344a238c88da988667c42c (patch) | |
tree | 05589af9cad2d6944d7927d09751da7da03d77f5 /lib/inets/src | |
parent | e9134d6ac5ee7efa597fe5887ce030cb25a19227 (diff) | |
parent | 6f5541f5a734c086e48a70b3f9c2261293893b6a (diff) | |
download | otp-2e439788218f4f81e9344a238c88da988667c42c.tar.gz otp-2e439788218f4f81e9344a238c88da988667c42c.tar.bz2 otp-2e439788218f4f81e9344a238c88da988667c42c.zip |
Merge branch 'peterdmv/httpd_reload_config/ERL-578/OTP-15025'
* peterdmv/httpd_reload_config/ERL-578/OTP-15025:
inets: Fix httpd:reload_config/2
Change-Id: Ib02587ac75f7f9f4ce665c6ead54b5ab11560411
Diffstat (limited to 'lib/inets/src')
-rw-r--r-- | lib/inets/src/http_server/httpd.erl | 29 |
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, []). |