Skip to content

Commit

Permalink
Merge pull request #8914 from nilbus/fix-header-bloat
Browse files Browse the repository at this point in the history
Remove header bloat introduced by BestStandardsSupport middleware
  • Loading branch information
rafaelfranca committed Jan 16, 2013
2 parents 8492396 + 7925884 commit cfdd5cb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions actionpack/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Rails 4.0.0 (unreleased) ##

* `BestStandardsSupport` no longer duplicates `X-UA-Compatible` values on
each request to prevent header size from blowing up.

*Edward Anderson*

* Change the behavior of route defaults so that explicit defaults are no longer
required where the key is not part of the path. For example:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ def call(env)
status, headers, body = @app.call(env)

if headers["X-UA-Compatible"] && @header
headers["X-UA-Compatible"] << "," << @header.to_s
unless headers["X-UA-Compatible"][@header]
headers["X-UA-Compatible"] << "," << @header.to_s
end
else
headers["X-UA-Compatible"] = @header
end
Expand Down
3 changes: 2 additions & 1 deletion actionpack/test/dispatch/best_standards_support_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ def test_without_best_standards_support
assert_equal nil, headers["X-UA-Compatible"]
end

def test_appends_to_app_headers
def test_appends_to_app_headers_without_duplication_after_multiple_requests
app_headers = { "X-UA-Compatible" => "requiresActiveX=true" }
_, headers, _ = app(true, app_headers).call({})
_, headers, _ = app(true, app_headers).call({})

expects = "requiresActiveX=true,IE=Edge,chrome=1"
assert_equal expects, headers["X-UA-Compatible"]
Expand Down

0 comments on commit cfdd5cb

Please sign in to comment.