How can you get the host of an NSURL without the subdomains?
Here are some inputs.
The part that should remain is in bold, and what should be stripped is in italic:
server.com
www.server.com
media.server.com
host1.media.server.com
So far, sounds very easy to implement.
But it should also correctly handle the following inputs, as well as any weird case I didn't think about that is commonly accepted or specified in any relevant RFC.
server.co.uk
media.server.co.uk
127.0.0.1
...
See Extract domain name from a host name This problem doesn't seem to have an easy solution.