Github user kxepal commented on the pull request:
https://github.com/apache/couchdb-chttpd/pull/114#issuecomment-211125278
Some ideas:
1. Let `max_document_size` work only for document updates;
2. Add `require_content_length` option which enforces all the requests to
specify Content-Length. This applies mostly for multipart body parts with
document content. Or just always require that header without any additional
options (generally, that's good idea);
3. Then, for `POST|PUT /db/doc` we can check `Content-Length` header and
reject too large requests without parsing payload;
4. For multipart requests we can do the same (because p.2). Or just say,
that document size is document size + sum(size of all the attachments), and
then just again check `Content-Length` header, but without parsing payload.
Transfer chunking request with multipart content doesn't works anyway (2295
issue iirc);
5. That was the lightweight logic. For `_bulk_docs` / `_update` handlers
we'll have to use heavy logic based of determining document size from term
format based on `exceed_doc_size/2`;
---
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.
---