Same-domain checking with relative protocols

The domain check checks hostname, then protocol, if it exists.