couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject svn commit: r1127715 - in /couchdb/trunk/src/couchdb: couch_db.erl couch_httpd_db.erl
Date Wed, 25 May 2011 23:03:28 GMT
Author: rnewson
Date: Wed May 25 23:03:28 2011
New Revision: 1127715

URL: http://svn.apache.org/viewvc?rev=1127715&view=rev
Log:
don't read more of an attachment than Content-Length states. (patch by Paul Davis, dictated
not read).

Modified:
    couchdb/trunk/src/couchdb/couch_db.erl
    couchdb/trunk/src/couchdb/couch_httpd_db.erl

Modified: couchdb/trunk/src/couchdb/couch_db.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_db.erl?rev=1127715&r1=1127714&r2=1127715&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_db.erl (original)
+++ couchdb/trunk/src/couchdb/couch_db.erl Wed May 25 23:03:28 2011
@@ -998,7 +998,7 @@ with_stream(Fd, #att{md5=InMd5,type=Type
 write_streamed_attachment(_Stream, _F, 0) ->
     ok;
 write_streamed_attachment(Stream, F, LenLeft) when LenLeft > 0 ->
-    Bin = F(),
+    Bin = F(lists:min([LenLeft, 16#2000])),
     ok = couch_stream:write(Stream, Bin),
     write_streamed_attachment(Stream, F, LenLeft - size(Bin)).
 

Modified: couchdb/trunk/src/couchdb/couch_httpd_db.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_db.erl?rev=1127715&r1=1127714&r2=1127715&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_db.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_db.erl Wed May 25 23:03:28 2011
@@ -1071,7 +1071,7 @@ db_attachment_req(#httpd{method=Method,m
                         end,
                         
                         
-                        fun() -> couch_httpd:recv(Req, 0) end
+                        fun(Size) -> couch_httpd:recv(Req, Size) end
                     end,
                 att_len = case couch_httpd:header_value(Req,"Content-Length") of
                     undefined ->



Mime
View raw message