Avoiding port# -1 if port not set in URL