UPD : refactoring comment
Adding a fallback for getallheaders in case of php < 5.4 and fast cgi installation