Added the toUrl() method

Also changed the functionality of the [ protocol ] option to reset
the [ port ] configuration to the default when the [ protocol ] is set.