소스 검색

Behave consistently on errors

pull/62/head
Chandrashekhar Mullaparthi 13 년 전
부모
커밋
26d34d542f
1개의 변경된 파일16개의 추가작업 그리고 12개의 파일을 삭제
  1. +16
    -12
      src/ibrowse_lib.erl

+ 16
- 12
src/ibrowse_lib.erl 파일 보기

@ -180,18 +180,22 @@ get_value(Tag, TVL) ->
V.
parse_url(Url) ->
case parse_url(Url, get_protocol, #url{abspath=Url}, []) of
#url{host_type = undefined, host = Host} = UrlRec ->
case inet_parse:address(Host) of
{ok, {_, _, _, _, _, _, _, _}} ->
UrlRec#url{host_type = ipv6_address};
{ok, {_, _, _, _}} ->
UrlRec#url{host_type = ipv4_address};
_ ->
UrlRec#url{host_type = hostname}
end;
Else ->
Else
try
case parse_url(Url, get_protocol, #url{abspath=Url}, []) of
#url{host_type = undefined, host = Host} = UrlRec ->
case inet_parse:address(Host) of
{ok, {_, _, _, _, _, _, _, _}} ->
UrlRec#url{host_type = ipv6_address};
{ok, {_, _, _, _}} ->
UrlRec#url{host_type = ipv4_address};
_ ->
UrlRec#url{host_type = hostname}
end;
_ ->
{error, invalid_uri}
end
catch _:_ ->
{error, invalid_uri}
end.
parse_url([$:, $/, $/ | _], get_protocol, Url, []) ->

불러오는 중...
취소
저장