Improve the reliability of the port number extraction when `url.port` is undefined

This slightly improves the port number extraction to make it work when more complex URLs are used.
The default ports are already correctly handled in the `primus.uri` method.