Browse Source

Update cowlib to 0.6.1

Loïc Hoguin 11 years ago
parent
commit
0502452967
3 changed files with 6 additions and 10 deletions
  1. 1 1
      Makefile
  2. 1 1
      rebar.config
  3. 4 8
      src/cowboy_req.erl

+ 1 - 1
Makefile

@@ -13,7 +13,7 @@ PLT_APPS = crypto public_key ssl
 # Dependencies.
 
 DEPS = cowlib ranch
-dep_cowlib = pkg://cowlib 0.6.0
+dep_cowlib = pkg://cowlib 0.6.1
 dep_ranch = pkg://ranch 0.9.0
 
 TEST_DEPS = ct_helper gun

+ 1 - 1
rebar.config

@@ -1,4 +1,4 @@
 {deps, [
-	{cowlib, ".*", {git, "git://github.com/extend/cowlib.git", "0.6.0"}},
+	{cowlib, ".*", {git, "git://github.com/extend/cowlib.git", "0.6.1"}},
 	{ranch, ".*", {git, "git://github.com/extend/ranch.git", "0.9.0"}}
 ]}.

+ 4 - 8
src/cowboy_req.erl

@@ -100,11 +100,7 @@
 	-> {ok, binary()}
 	| {error, atom()}).
 -type transfer_decode_fun() :: fun((binary(), any())
-	-> {ok, binary(), binary(), any()}
-	| more | {more, non_neg_integer(), binary(), any()}
-	| {done, non_neg_integer(), binary()}
-	| {done, binary(), non_neg_integer(), binary()}
-	| {error, atom()}).
+	-> cow_http_te:decode_ret()).
 
 -type resp_body_fun() :: fun((any(), module()) -> ok).
 -type send_chunk_fun() :: fun((iodata()) -> ok | {error, atom()}).
@@ -571,13 +567,13 @@ transfer_decode(Data, Req=#http_req{body_state={stream, _,
 			content_decode(ContentDecode, Data2,
 				Req#http_req{body_state={stream, 0,
 				TransferDecode, TransferState2, ContentDecode}});
-		{more, Data2, Length, TransferState2} ->
+		{more, Data2, Length, TransferState2} when is_integer(Length) ->
 			content_decode(ContentDecode, Data2,
 				Req#http_req{body_state={stream, Length,
 				TransferDecode, TransferState2, ContentDecode}});
-		{more, Data2, Length, Rest, TransferState2} ->
+		{more, Data2, Rest, TransferState2} ->
 			content_decode(ContentDecode, Data2,
-				Req#http_req{buffer=Rest, body_state={stream, Length,
+				Req#http_req{buffer=Rest, body_state={stream, 0,
 				TransferDecode, TransferState2, ContentDecode}});
 		{done, Length, Rest} ->
 			Req2 = transfer_decode_done(Length, Rest, Req),