Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Move the supported uri scheme set into logplex_drain.
Browse files Browse the repository at this point in the history
  • Loading branch information
archaelus committed May 24, 2012
1 parent a6e84e3 commit f3c8068
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/logplex_drain.erl
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ new_token(Retries) ->
parse_url(UrlBin) when is_binary(UrlBin) ->
parse_url(binary_to_list(UrlBin));
parse_url(Url) when is_list(Url) ->
case uri:parse(Url) of
case uri:parse(Url, [{scheme_defaults, uri_schemes()}]) of
{ok, Uri} ->
Uri;
{error, _} = Err ->
Expand All @@ -217,6 +217,12 @@ valid_uri({Scheme, _, _, _, _, _}) ->
{error, {unknown_scheme, Scheme}};
valid_uri({error, _} = Err) -> Err.

uri_schemes() ->
[{http, 80}
,{https, 443}
,{syslog, 601}
,{udpsyslog, 514}
].

has_valid_uri(#drain{uri=Uri}) ->
case valid_uri(Uri) of
Expand Down

0 comments on commit f3c8068

Please sign in to comment.