Skip to content
This repository has been archived by the owner. It is now read-only.
Browse files
Rename max_document_size to max_http_request_size
`max_document_size` is implemented as `max_http_request_size`. There was no
real check for document size. In some cases the implementation was close enough
of a proxy (PUT-ing and GET-ing single docs), but in some edge cases, like
_bulk_docs requests the discrepancy between request size and document size
could be rather large.

The section was changed accordingly from `couchdb` to `httpd`. `httpd` was
chosen as it applies to both clustered as well as local interface.

There is a parallel effort to implement an actual max_document_size check. The
set of commit should be merged close enough together to allow for a backwards
compatible transition.

  • Loading branch information
nickva committed Mar 8, 2017
1 parent f99e30c commit 0420f404a7ba2c5c5964f2ae5a87cda1c2178387
Showing 2 changed files with 4 additions and 5 deletions.
@@ -451,7 +451,7 @@ validate_ctype(Req, Ctype) ->

check_max_request_length(Req) ->
Len = list_to_integer(header_value(Req, "Content-Length", "0")),
MaxLen = config:get_integer("couchdb", "max_document_size", 4294967296),
MaxLen = config:get_integer("httpd", "max_http_request_size", 4294967296),
case Len > MaxLen of
true ->
exit({body_too_large, Len});
@@ -576,8 +576,7 @@ body_length(#httpd{mochi_req=MochiReq}) ->

body(#httpd{mochi_req=MochiReq, req_body=undefined}) ->
MaxSize = list_to_integer(
config:get("couchdb", "max_document_size", "4294967296")),
MaxSize = config:get_integer("httpd", "max_http_request_size", 4294967296),
body(#httpd{req_body=ReqBody}) ->
@@ -63,8 +63,8 @@ json_req_obj(#httpd{mochi_req=Req,
}, Db, DocId) ->
Body = case ReqBody of
undefined ->
MaxSize = list_to_integer(
config:get("couchdb", "max_document_size", "4294967296")),
MaxSize = config:get_integer("httpd", "max_http_request_size",
Else -> Else

0 comments on commit 0420f40

Please sign in to comment.