-
Notifications
You must be signed in to change notification settings - Fork 436
Open
Description
It looks like hackney is just splitting on @ and winds up trying to treat part of the credentials as the port when a url containing @ in the credentials is parsed.
iex(3)> :hackney_url.parse_url("https://user@domain.com:p@assword@domain.com/some/path")
** (ArgumentError) argument error
:erlang.list_to_integer('p@assword@domain.com')
(hackney 1.16.0) /Users/adamkittelson/Code/paperboy/deps/hackney/src/hackney_url.erl:260: :hackney_url.parse_netloc/2
While this is admittedly a weird thing to do it is technically valid and parses correctly in other libraries. Elixir's URI module for example is able to parse it:
URI.parse("https://user@domain.com:p@assword@domain.com/some/path")
%URI{
authority: "user@domain.com:p@assword@domain.com",
fragment: nil,
host: "domain.com",
path: "/some/path",
port: 443,
query: nil,
scheme: "https",
userinfo: "user@domain.com:p@assword"
}
For now I'm able to work around by parsing with URI and using the result to create the hackney_url record myself and passing that to hackney:request/5 but it would be great if hackney_url:parse_url/1 could be updated to follow the RFC.
The Elixir implementation for URI.parse/1 is here if that is useful: https://github.com/elixir-lang/elixir/blob/v1.10.0/lib/elixir/lib/uri.ex#L455
Thanks!
Adam
Metadata
Metadata
Assignees
Labels
No labels