aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeven Du <[email protected]>2012-06-21 11:12:27 +0800
committerLoïc Hoguin <[email protected]>2012-07-31 12:51:36 +0200
commit2645044c6b021bee0207a68305e4ff89af122d1a (patch)
treefe10552950b7eeb245fb66b9b9cec385a6a589d0
parent76d6ed83ceb8dfd4b70336c24757b55cfad758f0 (diff)
downloadcowboy-2645044c6b021bee0207a68305e4ff89af122d1a.tar.gz
cowboy-2645044c6b021bee0207a68305e4ff89af122d1a.tar.bz2
cowboy-2645044c6b021bee0207a68305e4ff89af122d1a.zip
Fix stream_body when used by multipart
-rw-r--r--src/cowboy_http_req.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cowboy_http_req.erl b/src/cowboy_http_req.erl
index 2789bb4..9f3bf2e 100644
--- a/src/cowboy_http_req.erl
+++ b/src/cowboy_http_req.erl
@@ -472,7 +472,13 @@ stream_body(Req=#http_req{buffer=Buffer, body_state={stream, _, _, _}})
stream_body(Req=#http_req{body_state={stream, _, _, _}}) ->
stream_body_recv(Req);
stream_body(Req=#http_req{body_state=done}) ->
- {done, Req}.
+ {done, Req};
+stream_body(Req=#http_req{body_state={multipart, _N, _Fun},
+ transport=Transport, socket=Socket}) ->
+ case Transport:recv(Socket, 0, 5000) of
+ {ok, Data} -> {ok, Data, Req};
+ {error, Reason} -> {error, Reason}
+ end.
-spec stream_body_recv(#http_req{})
-> {ok, binary(), #http_req{}} | {error, atom()}.