rails/rails — pull request #8914 by nilbus (2013-01-12 16:01:19+00:00)
Title: Remove header bloat introduced by BestStandardsSupport middleware

After the Rails server ran for long enough, Chome started returning a `net::ERR_RESPONSE_HEADERS_TOO_BIG` error on every page load, and curl would error with `curl: (27) Avoided giant realloc for header (max is 102400)!`. A server restart would reset the headers and made the problem temporarily go away.

Investigating showed that the same `IE=Edge,` headers were being appended on every request until finally the header size exceeded the 100k limit that browsers impose.

This patch ensures that the IE=Edge and other header variables only get appended to the X-UA-Compatible header if they are not there already, and it makes the test pass that I modified to catch the problem.

The commit that introduced this problem (d8c1404107501e131e4c7c653794768f5c461793, @nikitug) was applied to both master and 3-2-stable, so this fix should be backported to 3-2-stable as well.