From 9ebb79a24eecc2004a211b2475ffb7b34f31d138 Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Tue, 20 Jul 2010 01:04:22 +0000 Subject: require application/json content-type in the remaining places where a POST has side-effects git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.0.x@965702 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_httpd_misc_handlers.erl | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/couchdb/couch_httpd_misc_handlers.erl') diff --git a/src/couchdb/couch_httpd_misc_handlers.erl b/src/couchdb/couch_httpd_misc_handlers.erl index 205ebc6f..0a6f4a42 100644 --- a/src/couchdb/couch_httpd_misc_handlers.erl +++ b/src/couchdb/couch_httpd_misc_handlers.erl @@ -79,6 +79,7 @@ handle_task_status_req(Req) -> send_method_not_allowed(Req, "GET,HEAD"). handle_replicate_req(#httpd{method='POST'}=Req) -> + couch_httpd:validate_ctype(Req, "application/json"), PostBody = couch_httpd:json_body_obj(Req), try couch_rep:replicate(PostBody, Req#httpd.user_ctx) of {ok, {continuous, RepId}} -> @@ -102,6 +103,7 @@ handle_replicate_req(Req) -> handle_restart_req(#httpd{method='POST'}=Req) -> + couch_httpd:validate_ctype(Req, "application/json"), ok = couch_httpd:verify_is_server_admin(Req), couch_server_sup:restart_core_server(), send_json(Req, 200, {[{ok, true}]}); @@ -189,6 +191,7 @@ handle_config_req(Req) -> % httpd db handlers increment_update_seq_req(#httpd{method='POST'}=Req, Db) -> + couch_httpd:validate_ctype(Req, "application/json"), {ok, NewSeq} = couch_db:increment_update_seq(Db), send_json(Req, {[{ok, true}, {update_seq, NewSeq} -- cgit v1.2.3