From 496e3b2e876b74b3da3007268271c3c667e8fbee Mon Sep 17 00:00:00 2001 From: Christopher Lenz Date: Sun, 25 May 2008 22:22:29 +0000 Subject: Use limit of 4GB for document PUT requests, instead of the MochiWeb default of 1MB. Closes COUCHDB-37. git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@660050 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_httpd.erl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl index 239fd697..2324171e 100644 --- a/src/couchdb/couch_httpd.erl +++ b/src/couchdb/couch_httpd.erl @@ -15,6 +15,9 @@ -export([start_link/3, stop/0, handle_request/2]). +% Maximum size of document PUT request body (4GB) +-define(MAX_DOC_SIZE, (4*1024*1024*1024)). + -record(doc_query_args, { options = [], rev = "", @@ -354,7 +357,7 @@ handle_db_request(Req, 'GET', {DbName, _Db, ["_view", DocId, ViewName]}) -> direction = Dir, start_docid = StartDocId, end_docid = EndDocId - } = QueryArgs = parse_view_query(Req), + } = QueryArgs = parse_view_query(Req), case couch_view:get_map_view({DbName, "_design/" ++ DocId, ViewName}) of {ok, View} -> {ok, RowCount} = couch_view:get_row_count(View), @@ -524,7 +527,7 @@ handle_doc_request(Req, 'GET', _DbName, Db, DocId) -> end; handle_doc_request(Req, 'PUT', _DbName, Db, DocId) -> - Json = {obj, DocProps} = cjson:decode(Req:recv_body()), + Json = {obj, DocProps} = cjson:decode(Req:recv_body(?MAX_DOC_SIZE)), DocRev = proplists:get_value("_rev", DocProps), Etag = case Req:get_header_value("If-Match") of undefined -> -- cgit v1.2.3