Added null check; getHost() returns null for data URIs.