[HttpFoundation] Optimize ServerBag::getHeaders()

isset() vs in_array makes it take half the time (1ms/req here)
substr() does not have to scan the whole string so it's a wee bit faster
[HttpFoundation] Avoid a few unnecessary str_replace() calls
[HttpKernel] Avoid updating the context if the request did not change

Due to the BC $this->setRequest() call in the onKernelRequest method, the
request is set twice every time in Symfony, and RequestContext::fromRequest
takes 1ms to run here so if we can skip one call it is a win.
merged branch Seldaek/optim (PR #7931)

This PR was merged into the master branch.

Discussion
----------

A few optimizations

Commits
-------

ea633f5 [HttpKernel] Avoid updating the context if the request did not change
997d549 [HttpFoundation] Avoid a few unnecessary str_replace() calls
f5e7f24 [HttpFoundation] Optimize ServerBag::getHeaders()