Trim port from domain

Depending on the used environment the port might be appended to the host header resulting in an inaccessible instance when initially setting up on a system with a different HTTP or HTTPS port. (for example test:500)

To test this setup ownCloud under a different port with and without this patch. (heads-up: localhost is always white-listed, so use a different domain)

@jnfrmarks Please test carefully and also decide (together with @karlitschek) whether this warrants a backport. I'd vote for yes.
A test for IPv6 without port would be nice