Github user davisp commented on the pull request:
https://github.com/apache/couchdb-chttpd/pull/114#issuecomment-216596670
Couple things jump out at me here. First, this appears to be opening up a
bit of a DOS vector in that the max body size is not hard coded to 4GiB without
the ability for an admin to change that. I'd follow @kxepal's suggestion to add
a max_http_body_size parameter that more specifically covers what
max_document_size now covers.
Also, I would do away with trying to selectively enforce the document size
based on a config parameter as well as just report errors for some documents in
a _bulk_docs body. Just force the max_document_size check against everything
and then throw an error if any doc in the array is too big (though include the
id so the user knows which one it was).
I'd also added the check for _update and the like as well as mentioned.
For multipart/mime requests we should look at doing something similar but
I'd implement it differently by crashing if we read more than max_document_size
bytes from the socket (though we'll also want to come up with a plan on how
that affects attachments). As mentioned we don't want to rely on the
Content-Length header as that's not always set and not always knowable in
advance (ie, think cat'ing a file to cURL upload or similar).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---