couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jch...@apache.org
Subject svn commit: r961905 - /couchdb/branches/1.0.x/src/couchdb/couch_httpd_db.erl
Date Thu, 08 Jul 2010 19:47:43 GMT
Author: jchris
Date: Thu Jul  8 19:47:43 2010
New Revision: 961905

URL: http://svn.apache.org/viewvc?rev=961905&view=rev
Log:
validate admin and content type for compact requests

Modified:
    couchdb/branches/1.0.x/src/couchdb/couch_httpd_db.erl

Modified: couchdb/branches/1.0.x/src/couchdb/couch_httpd_db.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/1.0.x/src/couchdb/couch_httpd_db.erl?rev=961905&r1=961904&r2=961905&view=diff
==============================================================================
--- couchdb/branches/1.0.x/src/couchdb/couch_httpd_db.erl (original)
+++ couchdb/branches/1.0.x/src/couchdb/couch_httpd_db.erl Thu Jul  8 19:47:43 2010
@@ -111,12 +111,15 @@ handle_changes_req(#httpd{method='GET'}=
 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}]});
 



Mime
View raw message