From 315582f0bd835205b65a99a5b4a82a278a0a2940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 20 Aug 2015 12:07:32 +0200 Subject: Filter out all unknown options, not just 2-tuple ones For example 'binary' was making things crash. --- src/ranch.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/ranch.erl') diff --git a/src/ranch.erl b/src/ranch.erl index e8db34e..9f764d3 100644 --- a/src/ranch.erl +++ b/src/ranch.erl @@ -125,7 +125,7 @@ get_protocol_options(Ref) -> set_protocol_options(Ref, Opts) -> ranch_server:set_protocol_options(Ref, Opts). --spec filter_options([{atom(), any()} | {raw, any(), any(), any()}], +-spec filter_options([inet | inet6 | {atom(), any()} | {raw, any(), any(), any()}], [atom()], Acc) -> Acc when Acc :: [any()]. filter_options(UserOptions, AllowedKeys, DefaultOptions) -> AllowedOptions = filter_user_options(UserOptions, AllowedKeys), @@ -147,6 +147,8 @@ filter_user_options([Opt = {raw, _, _, _}|Tail], AllowedKeys) -> true -> [Opt|filter_user_options(Tail, AllowedKeys)]; false -> filter_user_options(Tail, AllowedKeys) end; +filter_user_options([_|Tail], AllowedKeys) -> + filter_user_options(Tail, AllowedKeys); filter_user_options([], _) -> []. -- cgit v1.2.3