The resolve function looks for the @ when parsing the URL using find function. That finds the first @ which means the username is john.doe instead of john.doe@example.com. Using rfind instead resolves this issue. I'm not sure if this is valid according to the URL standard. It should not break any existing existing functionality as the hostname seems to not allow @ sign.
Perhaps a better approach would be to rely on an external crate for this. The url crate comes to mind.
Our counterparty uses email addresses as usernames. The connection string looks something like
The
resolve
function looks for the@
when parsing the URL usingfind
function. That finds the first@
which means the username isjohn.doe
instead ofjohn.doe@example.com
. Usingrfind
instead resolves this issue. I'm not sure if this is valid according to the URL standard. It should not break any existing existing functionality as the hostname seems to not allow @ sign.Perhaps a better approach would be to rely on an external crate for this. The url crate comes to mind.