Correctly parse domain name when a port number is attached. Return more meaningful http errors.