couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chewbra...@apache.org
Subject [15/50] couch commit: updated refs/heads/2080-port-cors-to-chttpd to 529339b
Date Tue, 02 Jun 2015 19:35:46 GMT
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 <kxepal@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/2080-port-cors-to-chttpd
Commit: 952a41c7a10fc4dcb0324d09c5be7e5d1d548803
Parents: aa36a18
Author: Samuel Tardieu <sam@rfc1149.net>
Authored: Thu Feb 19 09:44:53 2015 +0100
Committer: Alexander Shorin <kxepal@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} =


Mime
View raw message