couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From beno...@apache.org
Subject [10/10] couch-httpd commit: updated refs/heads/1994-merge-rcouch to 82e454a
Date Sun, 13 Jul 2014 12:34:25 GMT
add maintainance handler


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/f26c6689
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/tree/f26c6689
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/diff/f26c6689

Branch: refs/heads/1994-merge-rcouch
Commit: f26c6689fd78ffb77fd5c07f826308eb86db63f8
Parents: b897545
Author: benoitc <bchesneau@gmail.com>
Authored: Tue Jul 8 13:17:42 2014 +0200
Committer: benoitc <bchesneau@gmail.com>
Committed: Sun Jul 13 14:33:20 2014 +0200

----------------------------------------------------------------------
 src/couch_httpd_misc_handlers.erl | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/blob/f26c6689/src/couch_httpd_misc_handlers.erl
----------------------------------------------------------------------
diff --git a/src/couch_httpd_misc_handlers.erl b/src/couch_httpd_misc_handlers.erl
index 293ef00..26fd75c 100644
--- a/src/couch_httpd_misc_handlers.erl
+++ b/src/couch_httpd_misc_handlers.erl
@@ -13,9 +13,10 @@
 -module(couch_httpd_misc_handlers).
 
 -export([handle_welcome_req/2,handle_favicon_req/2,handle_utils_dir_req/2,
-    handle_all_dbs_req/1,handle_restart_req/1,
-    handle_uuids_req/1,handle_config_req/1,handle_log_req/1,
-    handle_task_status_req/1, handle_file_req/2]).
+         handle_all_dbs_req/1,handle_restart_req/1,
+         handle_uuids_req/1,handle_config_req/1,handle_log_req/1,
+         handle_task_status_req/1, handle_file_req/2,
+         handle_up_req/1]).
 
 -export([increment_update_seq_req/2]).
 
@@ -316,3 +317,13 @@ handle_log_req(#httpd{method='POST'}=Req) ->
     end;
 handle_log_req(Req) ->
     send_method_not_allowed(Req, "GET,POST").
+
+handle_up_req(#httpd{method='GET'} = Req) ->
+    case couch_config:get("couchdb", "maintenance_mode") of
+        "true" ->
+            couch_httpd:send_json(Req, 404, {[{status, maintenance_mode}]});
+        _ ->
+            couch_httpd:send_json(Req, 200, {[{status, ok}]})
+    end;
+handle_up_req(Req) ->
+    couch_httpd:send_method_not_allowed(Req, "GET,HEAD").


Mime
View raw message