diff options
author | Paweł Chmielowski <pawel@process-one.net> | 2022-05-06 10:14:50 +0200 |
---|---|---|
committer | Paweł Chmielowski <pawel@process-one.net> | 2022-05-06 10:14:50 +0200 |
commit | c7ab3274c5ce2e4e95843d6a258cdbf3a835180a (patch) | |
tree | bf49d6a9f572cb40a3ae0a6a2fd5033527849fac /src/misc.erl | |
parent | Have consistent schema type in misc:uri_parse (diff) |
Return userinfo from misc:uri_parse
Diffstat (limited to 'src/misc.erl')
-rw-r--r-- | src/misc.erl | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/misc.erl b/src/misc.erl index 7380011c..5eb2cf60 100644 --- a/src/misc.erl +++ b/src/misc.erl @@ -62,8 +62,8 @@ uri_parse(URL) when is_binary(URL) -> uri_parse(binary_to_list(URL)); uri_parse(URL) -> case http_uri:parse(URL) of - {ok, {Scheme, _UserInfo, Host, Port, Path, Query}} -> - {ok, atom_to_list(Scheme), Host, Port, Path, Query}; + {ok, {Scheme, UserInfo, Host, Port, Path, Query}} -> + {ok, atom_to_list(Scheme), UserInfo, Host, Port, Path, Query}; {error, _} = E -> E end. @@ -73,11 +73,11 @@ uri_parse(URL) when is_binary(URL) -> uri_parse(URL) -> case uri_string:parse(URL) of #{scheme := Scheme, host := Host, port := Port, path := Path} = M1 -> - {ok, Scheme, Host, Port, Path, maps:get(query, M1, "")}; + {ok, Scheme, maps:get(userinfo, M1, ""), Host, Port, Path, maps:get(query, M1, "")}; #{scheme := "https", host := Host, path := Path} = M2 -> - {ok, "https", Host, 443, Path, maps:get(query, M2, "")}; + {ok, "https", maps:get(userinfo, M2, ""), Host, 443, Path, maps:get(query, M2, "")}; #{scheme := "http", host := Host, path := Path} = M3 -> - {ok, "http", Host, 80, Path, maps:get(query, M3, "")}; + {ok, "http", maps:get(userinfo, M3, ""), Host, 80, Path, maps:get(query, M3, "")}; {error, Atom, _} -> {error, Atom} end. |