Making host autodetection implementation close to C-code implementation. Be warned: $_SERVER['HTTP_HOST'] is vulnerable.