@@ -51,6 +51,8 @@ find_boundary(ReqData) ->
5151
5252% @doc Turn a multipart form into component parts.
5353% @spec get_all_parts(incoming_req_body(), boundary()) -> [fpart()]
54+ get_all_parts (Body , Boundary ) when is_list (Body ), is_list (Boundary ) ->
55+ get_all_parts (list_to_binary (Body ), Boundary );
5456get_all_parts (Body , Boundary ) when is_binary (Body ), is_list (Boundary ) ->
5557 StreamStruct = send_streamed_body (Body ,1024 ),
5658 getparts1 (stream_parts (StreamStruct , Boundary ), []).
@@ -71,6 +73,8 @@ stream_form({Hunk, Next}, Boundary, []) ->
7173 stream_form (get_more_data (Next ), Boundary , re :split (Hunk , Boundary ,[]));
7274stream_form ({Hunk , Next }, Boundary , [<<>>|DQ ]) ->
7375 stream_form ({Hunk , Next }, Boundary , DQ );
76+ stream_form ({Hunk , Next }, Boundary , [<<" \r\n " >>|DQ ]) ->
77+ stream_form ({Hunk , Next }, Boundary , DQ );
7478stream_form ({Hunk , Next }, Boundary , [H |[T1 |T2 ]]) ->
7579 {make_part (H ), fun () ->
7680 stream_form ({Hunk , Next }, Boundary , [T1 |T2 ]) end };
@@ -94,7 +98,7 @@ stream_parts([H|T]) -> {make_part(H), fun() -> stream_parts(T) end}.
9498
9599get_more_data (done ) -> {<<" --\n " >>, really_done };
96100get_more_data (Fun ) -> Fun ().
97-
101+
98102make_part (PartData ) ->
99103 % % Remove the trailing \r\n
100104 [HeadData , BodyWithCRLF ] = re :split (PartData , " \\ r\\ n\\ r\\ n" , [{parts ,2 }]),
0 commit comments