Fix internal domain handling to ensure various cookies get properly set

In the event that you are using accessing your instance with an IP
address on a non-standard port (eg 127.0.0.1:8080, like with
mw-vagrant), cookies were not properly being set right because we were
incorrectly identifying the 'base domain' (eg en.wikipedia.org ->
.wikipedia.org) by relying on the Host request header. Now we rely on
$wgServer and parse out the host name with wfParseUrl().

Change-Id: I0c58a9e5e19b917b791dacb958bda19c19049852
Merge "Fix internal domain handling to ensure various cookies get properly set"