Просмотр исходного кода

Filter out all unknown options, not just 2-tuple ones

For example 'binary' was making things crash.
Loïc Hoguin 9 лет назад
Родитель
Сommit
315582f0bd
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      src/ranch.erl

+ 3 - 1
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([], _) ->
 	[].