You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2015/02/20 00:40:49 UTC
couch commit: updated refs/heads/master to 952a41c
Repository: couchdb-couch
Updated Branches:
refs/heads/master aa36a185e -> 952a41c7a
Consume JSON body even when its content is ignored
"_ensure_full_commit" and "_compact" require that the content-type
be set to "application/json". However, when some content is provided
(such as "{}" in order to send a valid JSON external representation
for the empty object), CouchDB needs to ensure that this content
is read from the incoming HTTP request.
Mirrors the fix for COUCHDB-2583 in CouchDB 1.x.
This closes #36
Signed-off-by: Alexander Shorin <kx...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/952a41c7
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/952a41c7
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/952a41c7
Branch: refs/heads/master
Commit: 952a41c7a10fc4dcb0324d09c5be7e5d1d548803
Parents: aa36a18
Author: Samuel Tardieu <sa...@rfc1149.net>
Authored: Thu Feb 19 09:44:53 2015 +0100
Committer: Alexander Shorin <kx...@apache.org>
Committed: Fri Feb 20 02:40:28 2015 +0300
----------------------------------------------------------------------
src/couch_httpd_db.erl | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/952a41c7/src/couch_httpd_db.erl
----------------------------------------------------------------------
diff --git a/src/couch_httpd_db.erl b/src/couch_httpd_db.erl
index 34f04f2..938521c 100644
--- a/src/couch_httpd_db.erl
+++ b/src/couch_httpd_db.erl
@@ -163,6 +163,7 @@ handle_compact_req(#httpd{method='POST'}=Req, Db) ->
[_DbName, <<"_compact">>] ->
ok = couch_db:check_is_admin(Db),
couch_httpd:validate_ctype(Req, "application/json"),
+ _ = couch_httpd:body(Req),
{ok, _} = couch_db:start_compact(Db),
send_json(Req, 202, {[{ok, true}]});
[_DbName, <<"_compact">>, DesignName | _] ->
@@ -269,6 +270,7 @@ db_req(#httpd{path_parts=[_DbName]}=Req, _Db) ->
db_req(#httpd{method='POST',path_parts=[_,<<"_ensure_full_commit">>]}=Req, Db) ->
couch_httpd:validate_ctype(Req, "application/json"),
+ _ = couch_httpd:body(Req),
UpdateSeq = couch_db:get_update_seq(Db),
CommittedSeq = couch_db:get_committed_update_seq(Db),
{ok, StartTime} =