<< would cause 'P' (charcode 80) to be printed instead '80' in port number

Using '<<' doesn't actually append the port number in the url string, but a letter from charcode (here, 'P' instead of '80').
Converting the port number to a string before appending it tot he url fixes the issue.