Host fix

Fixed issue with detecting which port to use. …
- Always use the default port if the host header exists but there's no
  port.
- Added tests