Improve HTTP headers handling