Made extraction of HTTP headers more robust