couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tonysu...@apache.org
Subject [3/5] chttpd commit: updated refs/heads/2992-limit-doc-size to 1ac365d
Date Fri, 22 Apr 2016 06:02:19 GMT
Add in check for body size in multi_part requests

COUCHDB-2992


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

Branch: refs/heads/2992-limit-doc-size
Commit: 8ddb1ce7c6bd01511daea3e0d05c5d2edf9610ba
Parents: b0e5493
Author: Tony Sun <tony.sun@cloudant.com>
Authored: Thu Apr 21 18:42:51 2016 -0700
Committer: Tony Sun <tony.sun@cloudant.com>
Committed: Thu Apr 21 18:42:51 2016 -0700

----------------------------------------------------------------------
 src/chttpd_db.erl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/8ddb1ce7/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index d30a89b..2f6e0c0 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -698,7 +698,8 @@ db_doc_req(#httpd{method='POST', user_ctx=Ctx}=Req, Db, DocId) ->
     case proplists:is_defined("_doc", Form) of
     true ->
         Json = ?JSON_DECODE(couch_util:get_value("_doc", Form)),
-        Doc = couch_doc_from_req(Req, DocId, Json);
+        Doc = couch_doc_from_req(Req, DocId, Json),
+        ok = maybe_verify_body_size(Doc#doc.body);
     false ->
         Rev = couch_doc:parse_rev(list_to_binary(couch_util:get_value("_rev", Form))),
         {ok, [{ok, Doc}]} = fabric:open_revs(Db, DocId, [Rev], [])
@@ -754,6 +755,7 @@ db_doc_req(#httpd{method='PUT', user_ctx=Ctx}=Req, Db, DocId) ->
         {ok, Doc0, WaitFun, Parser} = couch_doc:doc_from_multi_part_stream(ContentType,
                 fun() -> receive_request_data(Req) end),
         Doc = couch_doc_from_req(Req, DocId, Doc0),
+        ok = maybe_verify_body_size(Doc#doc.body),
         try
             Result = send_updated_doc(Req, Db, DocId, Doc, RespHeaders, UpdateType),
             WaitFun(),


Mime
View raw message