Added getallheaders alternative

Function `getallheaders` may not exists on some environment.