summaryrefslogtreecommitdiff
path: root/src/couchdb
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2010-07-08 19:47:43 +0000
committerJohn Christopher Anderson <jchris@apache.org>2010-07-08 19:47:43 +0000
commita9fdb57e49431a50fd775dbf965d564916633f52 (patch)
tree6bc8207f593b4d702eeb8f546211b1442e4873db /src/couchdb
parentf6fc698327df18c0517b2428e8834c5587e999bb (diff)
validate admin and content type for compact requests
git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.0.x@961905 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb')
-rw-r--r--src/couchdb/couch_httpd_db.erl7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl
index f1514785..783ed9f9 100644
--- a/src/couchdb/couch_httpd_db.erl
+++ b/src/couchdb/couch_httpd_db.erl
@@ -111,12 +111,15 @@ handle_changes_req(#httpd{method='GET'}=Req, Db) ->
handle_changes_req(#httpd{path_parts=[_,<<"_changes">>]}=Req, _Db) ->
send_method_not_allowed(Req, "GET,HEAD").
-handle_compact_req(#httpd{method='POST',path_parts=[DbName,_,Id|_]}=Req, _Db) ->
+handle_compact_req(#httpd{method='POST',path_parts=[DbName,_,Id|_]}=Req, Db) ->
+ ok = couch_db:check_is_admin(Db),
couch_httpd:validate_ctype(Req, "application/json"),
ok = couch_view_compactor:start_compact(DbName, Id),
send_json(Req, 202, {[{ok, true}]});
handle_compact_req(#httpd{method='POST'}=Req, Db) ->
+ ok = couch_db:check_is_admin(Db),
+ couch_httpd:validate_ctype(Req, "application/json"),
ok = couch_db:start_compact(Db),
send_json(Req, 202, {[{ok, true}]});
@@ -125,6 +128,8 @@ handle_compact_req(Req, _Db) ->
handle_view_cleanup_req(#httpd{method='POST'}=Req, Db) ->
% delete unreferenced index files
+ ok = couch_db:check_is_admin(Db),
+ couch_httpd:validate_ctype(Req, "application/json"),
ok = couch_view:cleanup_index_files(Db),
send_json(Req, 202, {[{ok, true}]});