couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r1139897 - /couchdb/branches/1.1.x/src/couchdb/couch_httpd.erl
Date Sun, 26 Jun 2011 18:19:03 GMT
Author: fdmanana
Date: Sun Jun 26 18:19:03 2011
New Revision: 1139897

URL: http://svn.apache.org/viewvc?rev=1139897&view=rev
Log:
Merged revision 1139894 from trunk

    Don't steal data from subsequent requests in the pipeline

Modified:
    couchdb/branches/1.1.x/src/couchdb/couch_httpd.erl

Modified: couchdb/branches/1.1.x/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/src/couchdb/couch_httpd.erl?rev=1139897&r1=1139896&r2=1139897&view=diff
==============================================================================
--- couchdb/branches/1.1.x/src/couchdb/couch_httpd.erl (original)
+++ couchdb/branches/1.1.x/src/couchdb/couch_httpd.erl Sun Jun 26 18:19:03 2011
@@ -469,16 +469,24 @@ body_length(Req) ->
         Unknown -> {unknown_transfer_encoding, Unknown}
     end.
 
-body(#httpd{mochi_req=MochiReq, req_body=ReqBody}) ->
-    case ReqBody of
+body(#httpd{mochi_req=MochiReq, req_body=undefined} = Req) ->
+    case body_length(Req) of
         undefined ->
-            % Maximum size of document PUT request body (4GB)
             MaxSize = list_to_integer(
                 couch_config:get("couchdb", "max_document_size", "4294967296")),
             MochiReq:recv_body(MaxSize);
-        _Else ->
-            ReqBody
-    end.
+        chunked ->
+            ChunkFun = fun({0, _Footers}, Acc) ->
+                lists:reverse(Acc);
+            ({_Len, Chunk}, Acc) ->
+                [Chunk | Acc]
+            end,
+            recv_chunked(Req, 8192, ChunkFun, []);
+        Len ->
+            MochiReq:recv_body(Len)
+    end;
+body(#httpd{req_body=ReqBody}) ->
+    ReqBody.
 
 json_body(Httpd) ->
     ?JSON_DECODE(body(Httpd)).



Mime
View raw message