If you are going to modify the above subroutine, you'd be
better off to leave the URL as is, and do a URI decode
on the username and password. (Perhaps also on the path,
but I don't know how that's used in the rest of the program).
Then escape the slash in the username with %2F.