Reusable server url

Improve the re-usability of the addQueryArg() method

- Support SSL protocol
- Make the serverUrl code re-usable
Personally, I'd call this `guessServerUrl`. The update server can make a good guess, but it can't be 100% sure it has correctly determined the URL. Stuff like rewrite rules could still mess it up.