From c5e00c4188afd73c03bd7462ac2cc2d82387c5a6 Mon Sep 17 00:00:00 2001 From: Paul Joseph Davis Date: Tue, 19 May 2009 00:51:52 +0000 Subject: Add a configuration parameter for the default database handler. Closes COUCHDB-353 Thanks Brad Anderson git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@776143 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_httpd.erl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/couchdb') diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl index 1acb6b1b..8cdc8733 100644 --- a/src/couchdb/couch_httpd.erl +++ b/src/couchdb/couch_httpd.erl @@ -156,10 +156,19 @@ handle_request(MochiReq, UrlHandlers, DbUrlHandlers, DesignUrlHandlers) -> || 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)}) -- cgit v1.2.3