summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Lenz <cmlenz@apache.org>2008-05-25 22:22:29 +0000
committerChristopher Lenz <cmlenz@apache.org>2008-05-25 22:22:29 +0000
commit496e3b2e876b74b3da3007268271c3c667e8fbee (patch)
treee5408b3744758467106097fc50f378491ab7e90b
parentceada3b57cf9fb8c14bf2e0dd770b53a85ce4a3d (diff)
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
-rw-r--r--src/couchdb/couch_httpd.erl7
1 files 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 ->