You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by be...@apache.org on 2014/07/13 14:34:25 UTC

[10/10] couch-httpd commit: updated refs/heads/1994-merge-rcouch to 82e454a

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 <bc...@gmail.com>
Authored: Tue Jul 8 13:17:42 2014 +0200
Committer: benoitc <bc...@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").