couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject couchdb commit: updated refs/heads/1.x.x to 0035f8e
Date Thu, 19 Feb 2015 23:38:01 GMT
Repository: couchdb
Updated Branches:
  refs/heads/1.x.x c8bf07d94 -> 0035f8e33


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.

This closes #304

Fixes COUCHDB-2583

Signed-off-by: Alexander Shorin <kxepal@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/0035f8e3
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/0035f8e3
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/0035f8e3

Branch: refs/heads/1.x.x
Commit: 0035f8e33b374713af0133de20a599751166b1da
Parents: c8bf07d
Author: Samuel Tardieu <sam@rfc1149.net>
Authored: Mon Feb 16 14:17:10 2015 +0100
Committer: Alexander Shorin <kxepal@apache.org>
Committed: Fri Feb 20 02:29:16 2015 +0300

----------------------------------------------------------------------
 src/couchdb/couch_httpd_db.erl | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/0035f8e3/src/couchdb/couch_httpd_db.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl
index 6940e47..5691007 100644
--- a/src/couchdb/couch_httpd_db.erl
+++ b/src/couchdb/couch_httpd_db.erl
@@ -159,6 +159,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 | _] ->
@@ -261,6 +262,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} =


Mime
View raw message