Extract request headers from $_SERVER

`headers_list` returns response headers and the previous function `getallheaders` works only with Apache.

This code is partially extracted form Symfony2: https://github.com/symfony/HttpFoundation/blob/master/ServerBag.php#L28