Reusable server url

Improve the re-usability of the addQueryArg() method

- Support SSL protocol
- Make the serverUrl code re-usable
No Yoda conditions, please. Just do a straight comparison.