Added support for url encoded usernames, passwords and hostnames

I brought in some of the changes in #29