diff options
author | Ingela Anderton Andin <[email protected]> | 2015-05-21 16:03:25 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2015-06-04 10:47:35 +0200 |
commit | fdfda2fab0921d409789174556582db28141448e (patch) | |
tree | 3515e7d7dc29bda21a959bfd28a97fc1639933ce /lib/inets/src/http_server/httpd_conf.erl | |
parent | e99daf3212fbc381074e5be229465e9b6269e204 (diff) | |
download | otp-fdfda2fab0921d409789174556582db28141448e.tar.gz otp-fdfda2fab0921d409789174556582db28141448e.tar.bz2 otp-fdfda2fab0921d409789174556582db28141448e.zip |
inets: Add profile option
To enable the HTTP server to run in a virtualized environment,
where there can be more that one server that has the same
bind_address and port, we add a new option profile.
The profile name will be used in concatenation with bind_address and port
to identify the HTTP server instance.
The name profile was chosen as there is a similar concept in the HTTP client
where profile names can be used to instantiate client configurations.
Diffstat (limited to 'lib/inets/src/http_server/httpd_conf.erl')
-rw-r--r-- | lib/inets/src/http_server/httpd_conf.erl | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/inets/src/http_server/httpd_conf.erl b/lib/inets/src/http_server/httpd_conf.erl index a21eb915d4..9c70f8d1b8 100644 --- a/lib/inets/src/http_server/httpd_conf.erl +++ b/lib/inets/src/http_server/httpd_conf.erl @@ -25,7 +25,7 @@ %% Application internal API -export([load/1, load/2, load_mime_types/1, store/1, store/2, - remove/1, remove_all/1, get_config/2, get_config/3, + remove/1, remove_all/1, get_config/3, get_config/4, lookup_socket_type/1, lookup/2, lookup/3, lookup/4, validate_properties/1]). @@ -757,8 +757,9 @@ store(ConfigList0) -> ?hdrt("store", [{modules, Modules}]), Port = proplists:get_value(port, ConfigList0), Addr = proplists:get_value(bind_address, ConfigList0, any), + Profile = proplists:get_value(profile, ConfigList0, default), ConfigList = fix_mime_types(ConfigList0), - Name = httpd_util:make_name("httpd_conf", Addr, Port), + Name = httpd_util:make_name("httpd_conf", Addr, Port, Profile), ConfigDB = ets:new(Name, [named_table, bag, protected]), store(ConfigDB, ConfigList, lists:append(Modules, [?MODULE]), @@ -909,15 +910,15 @@ remove(ConfigDB) -> %% end. -get_config(Address, Port) -> - Tab = httpd_util:make_name("httpd_conf", Address, Port), +get_config(Address, Port, Profile) -> + Tab = httpd_util:make_name("httpd_conf", Address, Port, Profile), Properties = ets:tab2list(Tab), MimeTab = proplists:get_value(mime_types, Properties), NewProperties = proplists:delete(mime_types, Properties), [{mime_types, ets:tab2list(MimeTab)} | NewProperties]. -get_config(Address, Port, Properties) -> - Tab = httpd_util:make_name("httpd_conf", Address, Port), +get_config(Address, Port, Profile, Properties) -> + Tab = httpd_util:make_name("httpd_conf", Address, Port, Profile), Config = lists:map(fun(Prop) -> {Prop, httpd_util:lookup(Tab, Prop)} end, Properties), |