Рефакторинг обработчиков. Финальное тестирование #21
This commit is contained in:
@@ -237,10 +237,19 @@ extract_port(Url) ->
|
||||
[_, PortStr] -> {ok, list_to_integer(PortStr)};
|
||||
_ -> case string:split(Rest, "://", trailing) of
|
||||
[_, R] -> extract_port("https://" ++ R);
|
||||
_ -> {ok, 80}
|
||||
_ -> {ok, default_port(Url)}
|
||||
end
|
||||
end;
|
||||
_ -> {ok, 80}
|
||||
_ -> {ok, default_port(Url)}
|
||||
end.
|
||||
|
||||
default_port(Url) ->
|
||||
case string:prefix(Url, "wss://") of
|
||||
nomatch -> case string:prefix(Url, "ws://") of
|
||||
nomatch -> 80;
|
||||
_ -> 80
|
||||
end;
|
||||
_ -> 443
|
||||
end.
|
||||
|
||||
extract_host(Url) ->
|
||||
|
||||
Reference in New Issue
Block a user