summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDamien F. Katz <damien@apache.org>2009-11-17 17:41:56 +0000
committerDamien F. Katz <damien@apache.org>2009-11-17 17:41:56 +0000
commit9d85abd76bc6daf898bf1f466f4c036cbb8d881f (patch)
treedae1e1f83d50340d42135e6ab8ff6517a2a68848 /src
parent69ef80d733bdde2a0ba0bae19d2361b176d4e388 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/couchdb/couch_httpd.erl9
1 files changed, 4 insertions, 5 deletions
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} ->
<<DataChunk:Skip/binary, Rest/binary>> = Buffer,
Callback2 = Callback(DataChunk),
- {Buffer2, DataFun2} = DataFun(),
- Buffer3 = iolist_to_binary(Buffer2),
+ {NewData, DataFun2} = DataFun(),
read_until(Mp#mp{data_fun=DataFun2,
- buffer= <<Buffer3/binary, Rest/binary>>},
+ 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) ->
<<B1:K/binary, _/binary>> = 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.