You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2017/03/06 14:06:33 UTC

[1/2] couch commit: updated refs/heads/master to f99e30c

Repository: couchdb-couch
Updated Branches:
  refs/heads/master 63ef33747 -> f99e30c38


Efficiently bypass vhost handling if there are none

COUCHDB-3318


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

Branch: refs/heads/master
Commit: f706bb87be71006875c2fbaed3a14a18c79396f8
Parents: 38d5180
Author: Robert Newson <rn...@apache.org>
Authored: Mon Mar 6 12:05:33 2017 +0000
Committer: Robert Newson <rn...@apache.org>
Committed: Mon Mar 6 12:05:33 2017 +0000

----------------------------------------------------------------------
 src/couch_httpd_vhost.erl | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/f706bb87/src/couch_httpd_vhost.erl
----------------------------------------------------------------------
diff --git a/src/couch_httpd_vhost.erl b/src/couch_httpd_vhost.erl
index 91a2476..f23f41d 100644
--- a/src/couch_httpd_vhost.erl
+++ b/src/couch_httpd_vhost.erl
@@ -96,6 +96,14 @@ get_state() ->
 %% @doc Try to find a rule matching current Host heade. some rule is
 %% found it rewrite the Mochiweb Request else it return current Request.
 dispatch_host(MochiReq) ->
+    case vhost_enabled() of
+        true ->
+            dispatch_host_int(MochiReq);
+        false ->
+            MochiReq
+    end.
+
+dispatch_host_int(MochiReq) ->
     #vhosts_state{
         vhost_globals = VHostGlobals,
         vhosts = VHosts,
@@ -398,3 +406,14 @@ load_conf() ->
             "redirect_vhost_handler", DefaultVHostFun)),
 
     {VHostGlobals, VHosts, Fun}.
+
+%% cheaply determine if there are any virtual hosts
+%% configured at all.
+vhost_enabled() ->
+    case {config:get("httpd", "vhost_global_handlers"),
+          config:get("vhosts")} of
+        {undefined, []} ->
+            false;
+        _ ->
+            true
+    end.


[2/2] couch commit: updated refs/heads/master to f99e30c

Posted by rn...@apache.org.
Merge remote-tracking branch 'cloudant/3318-bypass-vhosts'


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

Branch: refs/heads/master
Commit: f99e30c38997e33538493204d5d58ea1a0f62de8
Parents: 63ef337 f706bb8
Author: Robert Newson <rn...@apache.org>
Authored: Mon Mar 6 14:06:09 2017 +0000
Committer: Robert Newson <rn...@apache.org>
Committed: Mon Mar 6 14:06:09 2017 +0000

----------------------------------------------------------------------
 src/couch_httpd_vhost.erl | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------