couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iil...@apache.org
Subject [32/50] couch-httpd commit: updated refs/heads/split_out_httpd_stack to e44a372
Date Tue, 01 Mar 2016 20:01:05 GMT
Extract get_stack_config/1


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/commit/2731706c
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/tree/2731706c
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/diff/2731706c

Branch: refs/heads/split_out_httpd_stack
Commit: 2731706c20b91817645017b614108305c554040b
Parents: d2b0973
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Fri Feb 26 13:32:56 2016 -0800
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Tue Mar 1 08:35:09 2016 -0800

----------------------------------------------------------------------
 src/couch_httpd_handler.erl | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/blob/2731706c/src/couch_httpd_handler.erl
----------------------------------------------------------------------
diff --git a/src/couch_httpd_handler.erl b/src/couch_httpd_handler.erl
index 5e9543a..6b106a1 100644
--- a/src/couch_httpd_handler.erl
+++ b/src/couch_httpd_handler.erl
@@ -51,19 +51,14 @@ start_link(Stack, https) ->
     start_link(Stack, Options);
 
 start_link(Stack, Options) ->
-    IP = case config:get("chttpd", "bind_address", "any") of
-             "any" -> any;
-             Else -> Else
-         end,
-    ok = couch_httpd:validate_bind_address(IP),
+    {IP, ServerOpts} = get_stack_config(Stack),
 
     Options1 = Options ++ [
         {loop, fun(Req) -> ?MODULE:handle_request(Stack, Req) end},
         {name, Stack: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)),
     case mochiweb_http:start(Options2) of
     {ok, Pid} ->
@@ -483,3 +478,8 @@ set_socket_options(Stack, MochiReq) ->
         SocketOpts ->
             ok = mochiweb_socket:setopts(MochiReq:get(socket), SocketOpts)
     end.
+
+get_stack_config(Stack) ->
+    IP = Stack:bind_address(),
+    ok = couch_httpd:validate_bind_address(IP),
+    {IP, Stack:server_options()}.


Mime
View raw message