This is an automated email from the ASF dual-hosted git repository.

nickva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/main by this push:
     new 5a15ed69b Use 2GB for max http request size
5a15ed69b is described below

commit 5a15ed69b49c8dab30a4276ebd633dba77b9490c
Author: Nick Vatamaniuc <[email protected]>
AuthorDate: Sun Nov 15 00:16:17 2026 -0500

    Use 2GB for max http request size
    
    It's still very large (2GB) but a bit more realistic as it fits better with 
the
    Erlang/OTP external term size limits.
---
 rel/overlay/etc/default.ini        | 2 +-
 src/chttpd/src/chttpd.erl          | 4 ++--
 src/chttpd/src/chttpd_external.erl | 2 +-
 src/chttpd/src/chttpd_node.erl     | 2 +-
 src/couch/src/couch_httpd.erl      | 8 ++++----
 src/couch/src/couch_util.erl       | 2 +-
 src/docs/src/config/http.rst       | 4 +++-
 7 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini
index a6d9345d0..f6bd13ffc 100644
--- a/rel/overlay/etc/default.ini
+++ b/rel/overlay/etc/default.ini
@@ -289,7 +289,7 @@ bind_address = 127.0.0.1
 ;x_forwarded_ssl = X-Forwarded-Ssl
 
 ; Maximum allowed http request size. Applies to both clustered and local port.
-;max_http_request_size = 4294967296 ; 4GB
+;max_http_request_size = 2147483647
 
 ; Set to true to decode + to space in db and doc_id parts.
 ;decode_plus_to_space = true
diff --git a/src/chttpd/src/chttpd.erl b/src/chttpd/src/chttpd.erl
index bbf88db8e..2dfa500a4 100644
--- a/src/chttpd/src/chttpd.erl
+++ b/src/chttpd/src/chttpd.erl
@@ -759,9 +759,9 @@ body_length(#httpd{mochi_req = MochiReq}) ->
 body(#httpd{mochi_req = MochiReq, req_body = ReqBody}) ->
     case ReqBody of
         undefined ->
-            % Maximum size of document PUT request body (4GB)
+            % Maximum size of document PUT request body (2GB)
             MaxSize = chttpd_util:get_chttpd_config_integer(
-                "max_http_request_size", 4294967296
+                "max_http_request_size", 2147483647
             ),
             Begin = os:timestamp(),
             try
diff --git a/src/chttpd/src/chttpd_external.erl 
b/src/chttpd/src/chttpd_external.erl
index ed292ca9b..da27e1bcb 100644
--- a/src/chttpd/src/chttpd_external.erl
+++ b/src/chttpd/src/chttpd_external.erl
@@ -80,7 +80,7 @@ json_req_obj_field(<<"headers">>, #httpd{mochi_req = Req}, 
_Db, _DocId) ->
     to_json_terms(Hlist);
 json_req_obj_field(<<"body">>, #httpd{req_body = undefined, mochi_req = Req}, 
_Db, _DocId) ->
     MaxSize = chttpd_util:get_chttpd_config_integer(
-        "max_http_request_size", 4294967296
+        "max_http_request_size", 2147483647
     ),
     try
         Req:recv_body(MaxSize)
diff --git a/src/chttpd/src/chttpd_node.erl b/src/chttpd/src/chttpd_node.erl
index b0ea3686c..6cd843f52 100644
--- a/src/chttpd/src/chttpd_node.erl
+++ b/src/chttpd/src/chttpd_node.erl
@@ -188,7 +188,7 @@ handle_node_req(#httpd{
     NewPath0 = "/" ++ lists:join("/", [couch_util:url_encode(P) || P <- 
PathParts]),
     NewRawPath = mochiweb_util:urlunsplit_path({NewPath0, Query, Fragment}),
     MaxSize = chttpd_util:get_chttpd_config_integer(
-        "max_http_request_size", 4294967296
+        "max_http_request_size", 2147483647
     ),
     NewOpts = [{body, MochiReq0:recv_body(MaxSize)} | MochiReq0:get(opts)],
     Ref = make_ref(),
diff --git a/src/couch/src/couch_httpd.erl b/src/couch/src/couch_httpd.erl
index 51075c6b4..df039c13f 100644
--- a/src/couch/src/couch_httpd.erl
+++ b/src/couch/src/couch_httpd.erl
@@ -570,7 +570,7 @@ validate_ctype(Req, Ctype) ->
 check_max_request_length(Req) ->
     Len = list_to_integer(header_value(Req, "Content-Length", "0")),
     MaxLen = chttpd_util:get_chttpd_config_integer(
-        "max_http_request_size", 4294967296
+        "max_http_request_size", 2147483647
     ),
     case Len > MaxLen of
         true ->
@@ -707,7 +707,7 @@ recv_chunked(#httpd{mochi_req = MochiReq}, MaxChunkSize, 
ChunkFun, InitState) ->
         ChunkFun,
         InitState,
         chttpd_util:get_chttpd_config_integer(
-            "max_http_request_size", 4294967296
+            "max_http_request_size", 2147483647
         )
     ).
 
@@ -716,7 +716,7 @@ body_length(#httpd{mochi_req = MochiReq}) ->
 
 body(#httpd{mochi_req = MochiReq, req_body = undefined}) ->
     MaxSize = chttpd_util:get_chttpd_config_integer(
-        "max_http_request_size", 4294967296
+        "max_http_request_size", 2147483647
     ),
     MochiReq:recv_body(MaxSize);
 body(#httpd{req_body = ReqBody}) ->
@@ -739,7 +739,7 @@ json_body_obj(Httpd) ->
     end.
 
 maybe_decompress(Httpd, Body) ->
-    MaxSize = chttpd_util:get_chttpd_config_integer("max_http_request_size", 
4294967296),
+    MaxSize = chttpd_util:get_chttpd_config_integer("max_http_request_size", 
2147483647),
     maybe_decompress(Httpd, Body, MaxSize).
 
 maybe_decompress(Httpd, Body, MaxSize) ->
diff --git a/src/couch/src/couch_util.erl b/src/couch/src/couch_util.erl
index b25b1458c..bd7a27c30 100644
--- a/src/couch/src/couch_util.erl
+++ b/src/couch/src/couch_util.erl
@@ -849,7 +849,7 @@ ext_term_size(_NotBinary) ->
     0.
 
 gunzip_with_limit(Data) ->
-    Limit = chttpd_util:get_chttpd_config_integer("max_http_request_size", 
4294967296),
+    Limit = chttpd_util:get_chttpd_config_integer("max_http_request_size", 
2147483647),
     gunzip_with_limit(Data, Limit).
 
 gunzip_with_limit(Data, Limit) when is_integer(Limit), Limit >= 0 ->
diff --git a/src/docs/src/config/http.rst b/src/docs/src/config/http.rst
index e1db07851..9117f45c3 100644
--- a/src/docs/src/config/http.rst
+++ b/src/docs/src/config/http.rst
@@ -211,6 +211,8 @@ HTTP Server Options
 
         .. versionchanged:: 3.2 moved from [httpd] to [chttpd] section
 
+        .. versionchanged:: 3.5.4 default lowered from 4GB to 2GB
+
         Limit the maximum size of the HTTP request body. This setting applies
         to all requests and it doesn't discriminate between single vs.
         multi-document operations. So setting it to 1MB would block a
@@ -221,7 +223,7 @@ HTTP Server Options
         large HTTP requests rather than for limiting maximum document sizes. ::
 
             [chttpd]
-            max_http_request_size = 4294967296 ; 4 GB
+            max_http_request_size = 2147483647
 
         .. warning::
            Before version 2.1.0 :config:option:`couchdb/max_document_size` was

Reply via email to