extended validate_host and validate_hostname to support optional naming