http_parse_headers function update

Part of previous function used deprecated code. Also wrapped with check
for existing function