Skip to content

Commit

Permalink
properly handle stream boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
justin committed Jun 16, 2009
1 parent 8c5e655 commit 5ef7966
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/webmachine_multipart.erl
Expand Up @@ -55,7 +55,7 @@ get_all_parts(Body, Boundary) when is_binary(Body), is_list(Boundary) ->
% @spec stream_parts(wm_stream(), boundary()) ->
% 'done_parts' | {fpart(), function()}
stream_parts(StreamStruct, Boundary) ->
stream_form(StreamStruct, Boundary, []).
stream_form(StreamStruct, "--" ++ Boundary, []).

stream_form(_, _, [<<"----\n">>|_]) -> done_parts;
stream_form(_, _, [<<"--\n">>|_]) -> done_parts;
Expand All @@ -78,6 +78,8 @@ stream_parts([]) -> done_parts;
% browsers are fun, and terminate posts slightly differently from each other:
stream_parts([<<"----\n">>]) -> done_parts;
stream_parts([<<"--\n">>]) -> done_parts;
stream_parts([<<"----\r\n">>]) -> done_parts;
stream_parts([<<"--\r\n">>]) -> done_parts;
stream_parts([<<"--\r\n--\n">>]) -> done_parts;
stream_parts([<<"--\r\n--\r\n">>]) -> done_parts;
stream_parts([H|T]) -> {make_part(H), fun() -> stream_parts(T) end}.
Expand Down

0 comments on commit 5ef7966

Please sign in to comment.