Allow underscores in trusted hosts

Underscores are valid characters in domain names, so don't prohibit them in trustedHosts[].
Also the domain name should be validated before creating the list with an invalid entry.
Merge pull request #6304 from stackcoder/patch-2

Allow underscores in trusted hosts