From 9d85abd76bc6daf898bf1f466f4c036cbb8d881f Mon Sep 17 00:00:00 2001 From: "Damien F. Katz" Date: Tue, 17 Nov 2009 17:41:56 +0000 Subject: Fix for broken multipart parsing code as mentioned in COUCHDB-570. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@881407 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_httpd.erl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl index 9c0a3668..caffdd51 100644 --- a/src/couchdb/couch_httpd.erl +++ b/src/couchdb/couch_httpd.erl @@ -679,10 +679,9 @@ read_until(#mp{data_fun=DataFun, buffer=Buffer}=Mp, Pattern, Callback) -> {partial, Skip} -> <> = Buffer, Callback2 = Callback(DataChunk), - {Buffer2, DataFun2} = DataFun(), - Buffer3 = iolist_to_binary(Buffer2), + {NewData, DataFun2} = DataFun(), read_until(Mp#mp{data_fun=DataFun2, - buffer= <>}, + buffer= iolist_to_binary([Rest | NewData])}, Pattern, Callback2); {exact, Skip} -> PatternLen = size(Pattern), @@ -761,8 +760,8 @@ partial_find(_B, _D, _N, 0) -> partial_find(B, D, N, K) -> <> = B, case D of - <<_Skip:N/binary, B1:K/binary>> -> - {partial, N, K}; + <<_Skip:N/binary, B1/binary>> -> + {partial, N}; _ -> partial_find(B, D, 1 + N, K - 1) end. -- cgit v1.2.3