Improved SSL (https) detection

Some SSL (https) servers/setups do not have the $_SERVER['HTTPS'] variable to on.
But they do have a $_SERVER['HTTP_X_FORWARDED_PROTO'] value set to 'https'.

See for more details: https://github.com/puma/puma/pull/200

This PR adds a check for that variable to the isSSLConnection method.
It also adds a few more checks and makes the whole thing more solid.

Also I have replaced some inline checks in other code to use this isSSLConnection method instead (= DRY).

#### Test instructions
Test if the different JUri methods and other functionalities that rely on SSL still work. And more-so if they now work on setups that use that HTTP_X_FORWARDED_PROTO var.