You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2018/07/13 14:30:44 UTC

[GitHub] janl commented on a change in pull request #1253: [DISCUSS] Validate new document writes against max_http_request_size

janl commented on a change in pull request #1253: [DISCUSS] Validate new document writes against max_http_request_size
URL: https://github.com/apache/couchdb/pull/1253#discussion_r202369083
 
 

 ##########
 File path: src/couch/src/couch_doc.erl
 ##########
 @@ -136,12 +136,27 @@ from_json_obj_validate(EJson, DbName) ->
     case couch_ejson_size:encoded_size(Doc#doc.body) =< MaxSize of
         true ->
              validate_attachment_sizes(Doc#doc.atts),
+             validate_total_document_size(Doc),
              Doc;
         false ->
             throw({request_entity_too_large, Doc#doc.id})
     end.
 
 
+% sum up the json body size + attachment body size and
+% make sure it is < max_http_request_size
+validate_total_document_size(#doc{id=DocId, body=Body, atts=Atts0}) ->
+    MaxReqSize = config:get_integer("httpd", "max_http_request_size", 4294967296), % 2 GB
+    Boundary = couch_uuids:random(), % mock boundary, is only used for the length
 
 Review comment:
   ```
   [16:26:10]  <+jan____>	rnewson: do you have a better name for to_tuple in https://github.com/apache/couchdb/pull/1253/files#r178029434?
   [16:27:14]  <+rnewson>	I don't, proceed with to_tuple.
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services