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)
Add workaround for older instances

To be removed with oCAdd workaround for older instances

To be removed with oC99
Add test for IPv6 without port
Merge pull request #12583 from owncloud/trim-port

Trim port from domain