diff --git a/.thumbs.yml b/.thumbs.yml new file mode 100644 index 00000000..f28fff75 --- /dev/null +++ b/.thumbs.yml @@ -0,0 +1,11 @@ +minimum_reviewers: 2 +merge: true +build_steps: + - make clean + - make deps + - make compile + - make test + - make xref + - make dialyzer +org_mode: true +timeout: 1800 diff --git a/rebar.lock b/rebar.lock new file mode 100644 index 00000000..4fc097e7 --- /dev/null +++ b/rebar.lock @@ -0,0 +1,4 @@ +[{<<"mochiweb">>, + {git,"git://github.com/basho/mochiweb.git", + {ref,"4d3882181d0e0e507a05115782a2b091a1db2be4"}}, + 0}]. diff --git a/src/webmachine_decision_core.erl b/src/webmachine_decision_core.erl index ec157584..954626a5 100644 --- a/src/webmachine_decision_core.erl +++ b/src/webmachine_decision_core.erl @@ -32,8 +32,8 @@ handle_request(Resource, ReqState) -> try d(v3b13) catch - error:_ -> - error_response(erlang:get_stacktrace()) + error:_:S -> + error_response(S) end. wrcall(X) -> diff --git a/src/webmachine_multipart.erl b/src/webmachine_multipart.erl index f7b87903..f2a21482 100644 --- a/src/webmachine_multipart.erl +++ b/src/webmachine_multipart.erl @@ -51,6 +51,8 @@ find_boundary(ReqData) -> % @doc Turn a multipart form into component parts. % @spec get_all_parts(incoming_req_body(), boundary()) -> [fpart()] +get_all_parts(Body, Boundary) when is_list(Body), is_list(Boundary) -> + get_all_parts(list_to_binary(Body), Boundary); get_all_parts(Body, Boundary) when is_binary(Body), is_list(Boundary) -> StreamStruct = send_streamed_body(Body,1024), getparts1(stream_parts(StreamStruct, Boundary), []). @@ -71,6 +73,8 @@ stream_form({Hunk, Next}, Boundary, []) -> stream_form(get_more_data(Next), Boundary, re:split(Hunk, Boundary,[])); stream_form({Hunk, Next}, Boundary, [<<>>|DQ]) -> stream_form({Hunk, Next}, Boundary, DQ); +stream_form({Hunk, Next}, Boundary, [<<"\r\n">>|DQ]) -> + stream_form({Hunk, Next}, Boundary, DQ); stream_form({Hunk, Next}, Boundary, [H|[T1|T2]]) -> {make_part(H), fun() -> stream_form({Hunk, Next}, Boundary, [T1|T2]) end}; @@ -94,7 +98,7 @@ stream_parts([H|T]) -> {make_part(H), fun() -> stream_parts(T) end}. get_more_data(done) -> {<<"--\n">>, really_done}; get_more_data(Fun) -> Fun(). - + make_part(PartData) -> %% Remove the trailing \r\n [HeadData, BodyWithCRLF] = re:split(PartData, "\\r\\n\\r\\n", [{parts,2}]),