You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2018/07/09 12:16:05 UTC
[couchdb] branch master updated: allow socket server configuration
for TLS httpd
This is an automated email from the ASF dual-hosted git repository.
jan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git
The following commit(s) were added to refs/heads/master by this push:
new 54577f1 allow socket server configuration for TLS httpd
54577f1 is described below
commit 54577f13de4b11ddecd8fb3ca67cde754cd4c94d
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Fri Jun 29 19:31:44 2018 +0200
allow socket server configuration for TLS httpd
---
src/chttpd/src/chttpd.erl | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/chttpd/src/chttpd.erl b/src/chttpd/src/chttpd.erl
index ae94ae6..c0179ba 100644
--- a/src/chttpd/src/chttpd.erl
+++ b/src/chttpd/src/chttpd.erl
@@ -104,10 +104,12 @@ start_link(https) ->
end,
SslOpts = ServerOpts ++ ClientOpts,
- Options =
+ Options0 =
[{port, Port},
{ssl, true},
{ssl_opts, SslOpts}],
+ CustomServerOpts = get_server_options("httpsd"),
+ Options = merge_server_options(Options0, CustomServerOpts),
start_link(https, Options).
start_link(Name, Options) ->
@@ -124,9 +126,8 @@ start_link(Name, Options) ->
{name, Name},
{ip, IP}
],
- ServerOptsCfg = config:get("chttpd", "server_options", "[]"),
- {ok, ServerOpts} = couch_util:parse_term(ServerOptsCfg),
- Options2 = lists:keymerge(1, lists:sort(Options1), lists:sort(ServerOpts)),
+ ServerOpts = get_server_options("chttpd"),
+ Options2 = merge_server_options(Options1, ServerOpts),
case mochiweb_http:start(Options2) of
{ok, Pid} ->
{ok, Pid};
@@ -135,6 +136,14 @@ start_link(Name, Options) ->
{error, Reason}
end.
+get_server_options(Module) ->
+ ServerOptsCfg = config:get(Module, "server_options", "[]"),
+ {ok, ServerOpts} = couch_util:parse_term(ServerOptsCfg),
+ ServerOpts.
+
+merge_server_options(A, B) ->
+ lists:keymerge(1, lists:sort(A), lists:sort(B)).
+
stop() ->
catch mochiweb_http:stop(https),
mochiweb_http:stop(?MODULE).