couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r776143 - in /couchdb/trunk: etc/couchdb/default.ini.tpl.in src/couchdb/couch_httpd.erl
Date Tue, 19 May 2009 00:51:53 GMT
Author: davisp
Date: Tue May 19 00:51:52 2009
New Revision: 776143

URL: http://svn.apache.org/viewvc?rev=776143&view=rev
Log:
Add a configuration parameter for the default database handler.

Closes COUCHDB-353

Thanks Brad Anderson


Modified:
    couchdb/trunk/etc/couchdb/default.ini.tpl.in
    couchdb/trunk/src/couchdb/couch_httpd.erl

Modified: couchdb/trunk/etc/couchdb/default.ini.tpl.in
URL: http://svn.apache.org/viewvc/couchdb/trunk/etc/couchdb/default.ini.tpl.in?rev=776143&r1=776142&r2=776143&view=diff
==============================================================================
--- couchdb/trunk/etc/couchdb/default.ini.tpl.in (original)
+++ couchdb/trunk/etc/couchdb/default.ini.tpl.in Tue May 19 00:51:52 2009
@@ -17,6 +17,7 @@
 port = 5984
 bind_address = 127.0.0.1
 authentication_handler = {couch_httpd, default_authentication_handler}
+default_handler = {couch_httpd_db, handle_request}
 WWW-Authenticate = Basic realm="administrator"
 
 [log]

Modified: couchdb/trunk/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd.erl?rev=776143&r1=776142&r2=776143&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd.erl Tue May 19 00:51:52 2009
@@ -156,10 +156,19 @@
                 || Part <- string:tokens(Path, "/")],
         db_url_handlers = DbUrlHandlers,
         design_url_handlers = DesignUrlHandlers
-        },
-    DefaultFun = fun couch_httpd_db:handle_request/1,
+    },
+
+    DefaultSpec = "{couch_httpd_db, handle_request}",
+    DefaultFun = make_arity_1_fun(
+        couch_config:get("httpd", "default_handler", DefaultSpec)
+    ),
     HandlerFun = couch_util:dict_find(HandlerKey, UrlHandlers, DefaultFun),
     
+    Self = self(),
+    ok = couch_config:register(
+        fun("httpd", "default_handler") -> exit(Self, config_change) end
+    ),
+
     {ok, Resp} =
     try
         HandlerFun(HttpReq#httpd{user_ctx=AuthenticationFun(HttpReq)})



Mime
View raw message