Simplified url resolution

Use a map instead of a bunch of if statements and arrays. Do a protocol
exists check instead of avoiding resolution of various protocols (no
idea why I was doing it any other way previously).