Reusable server url

Improve the re-usability of the addQueryArg() method

- Support SSL protocol
- Make the serverUrl code re-usable
Could do. Still would keep the Unix/Windows if/else to avoid accidentally changing a Unix path. Would put the `dirname()` in a variable though, to avoid doing that three times. Can you live with that ? I'll update the PR.