Browse Source

We accept iodata() when setting cookies; fix that

Loïc Hoguin 12 years ago
parent
commit
659ca05c54
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/cowboy_http.erl

+ 2 - 2
src/cowboy_http.erl

@@ -859,11 +859,11 @@ ce_identity(Data) ->
 -spec cookie_to_iodata(iodata(), iodata(), cowboy_req:cookie_opts())
 	-> iodata().
 cookie_to_iodata(Name, Value, Opts) ->
-	case binary:match(Name, [<<$=>>, <<$,>>, <<$;>>,
+	case binary:match(iolist_to_binary(Name), [<<$=>>, <<$,>>, <<$;>>,
 			<<$\s>>, <<$\t>>, <<$\r>>, <<$\n>>, <<$\013>>, <<$\014>>]) of
 		nomatch -> ok
 	end,
-	case binary:match(Value, [<<$,>>, <<$;>>,
+	case binary:match(iolist_to_binary(Value), [<<$,>>, <<$;>>,
 			<<$\s>>, <<$\t>>, <<$\r>>, <<$\n>>, <<$\013>>, <<$\014>>]) of
 		nomatch -> ok
 	end,