If the port is empty, you're going to add a `:` at the end, which is not what you expect. So, you must check against `80` and the empty string.