Allow hostnames to contain hyphen.

Currently hostnames cannot contain a hyphen ("-") anywhere.
This change allows domains to contain a hyphen, but not start or end with one.
See http://stackoverflow.com/q/2063213 for relevant discussion.