diff options
author | Loïc Hoguin <[email protected]> | 2015-08-20 12:07:32 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2015-08-20 12:07:32 +0200 |
commit | 315582f0bd835205b65a99a5b4a82a278a0a2940 (patch) | |
tree | b4ee072a34096ccf9a446c1c837e438088fc120a /src | |
parent | dd5367f370e00cb41188b8b61b254b635e8db8dd (diff) | |
download | ranch-315582f0bd835205b65a99a5b4a82a278a0a2940.tar.gz ranch-315582f0bd835205b65a99a5b4a82a278a0a2940.tar.bz2 ranch-315582f0bd835205b65a99a5b4a82a278a0a2940.zip |
Filter out all unknown options, not just 2-tuple ones
For example 'binary' was making things crash.
Diffstat (limited to 'src')
-rw-r--r-- | src/ranch.erl | 4 |
1 files changed, 3 insertions, 1 deletions
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([], _) -> []. |