couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vatam...@apache.org
Subject [1/2] chttpd commit: updated refs/heads/master to 4e9b4a6
Date Thu, 06 Oct 2016 21:27:03 GMT
Repository: couchdb-chttpd
Updated Branches:
  refs/heads/master d2c449b7b -> 4e9b4a64c


Add max_document_size checking for multipart PUT requests

Previously multipart/related PUT requests didn't check maximum request sizes.

This commit checks content-length and compares that with the maximum.

This means keeping the current "semantics" of max_document_size which actually
means "max request size". But this makes the check more efficient and can
be done earlier in request processing time.

PR depends on https://github.com/apache/couchdb-couch/pull/201 make sure to
merge that one first if accepted.

Jira: COUCHDB-3174


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

Branch: refs/heads/master
Commit: 5d7170c472d2ca72d4a0dd41eb7ae4434266be7d
Parents: 297493f
Author: Nick Vatamaniuc <vatamane@apache.org>
Authored: Tue Oct 4 02:58:32 2016 -0400
Committer: Nick Vatamaniuc <vatamane@apache.org>
Committed: Tue Oct 4 02:58:32 2016 -0400

----------------------------------------------------------------------
 src/chttpd_db.erl | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/5d7170c4/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index 07a5eba..8699320 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -761,6 +761,7 @@ db_doc_req(#httpd{method='PUT', user_ctx=Ctx}=Req, Db, DocId) ->
     RespHeaders = [{"Location", Loc}],
     case couch_util:to_list(couch_httpd:header_value(Req, "Content-Type")) of
     ("multipart/related;" ++ _) = ContentType ->
+        couch_httpd:check_max_request_length(Req),
         couch_httpd_multipart:num_mp_writers(mem3:n(mem3:dbname(Db#db.name), DocId)),
         {ok, Doc0, WaitFun, Parser} = couch_doc:doc_from_multi_part_stream(ContentType,
                 fun() -> receive_request_data(Req) end),


Mime
View raw message