Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of git@github.com:rails/rails

  • Loading branch information...
commit 12288a034120e8b1f90fcd4ae5881a858fd1425e 2 parents 926f464 + f48e899
David Heinemeier Hansson dhh authored
9 actionpack/lib/action_controller/mime_type.rb
View
@@ -71,8 +71,11 @@ def parse(accept_header)
# keep track of creation order to keep the subsequent sort stable
list = []
accept_header.split(/,/).each_with_index do |header, index|
- params = header.split(/;\s*q=/)
- list << AcceptItem.new(index, *params) unless params.empty?
+ params, q = header.split(/;\s*q=/)
+ if params
+ params.strip!
+ list << AcceptItem.new(index, params, q) unless params.empty?
+ end
end
list.sort!
@@ -145,7 +148,7 @@ def ===(list)
end
def ==(mime_type)
- return false unless mime_type
+ return false if mime_type.blank?
(@synonyms + [ self ]).any? do |synonym|
synonym.to_s == mime_type.to_s || synonym.to_sym == mime_type.to_sym
end
7 actionpack/test/controller/mime_type_test.rb
View
@@ -28,6 +28,13 @@ def test_parse_crappy_broken_acceptlines
expect = [Mime::HTML, Mime::XML, "image/*", Mime::TEXT, Mime::ALL]
assert_equal expect, Mime::Type.parse(accept).collect { |c| c.to_s }
end
+
+ # Accept header send with user HTTP_USER_AGENT: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1)
+ def test_parse_crappy_broken_acceptlines2
+ accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, , pronto/1.00.00, sslvpn/1.00.00.00, */*"
+ expect = ['image/gif', 'image/x-xbitmap', 'image/jpeg','image/pjpeg', 'application/x-shockwave-flash', 'application/vnd.ms-excel', 'application/vnd.ms-powerpoint', 'application/msword', 'pronto/1.00.00', 'sslvpn/1.00.00.00', Mime::ALL ]
+ assert_equal expect, Mime::Type.parse(accept).collect { |c| c.to_s }
+ end
def test_custom_type
Mime::Type.register("image/gif", :gif)
8 activesupport/lib/active_support/vendor/memcache-client-1.5.0/memcache.rb
View
@@ -278,12 +278,12 @@ def get_multi(*keys)
results = {}
- server_keys.each do |server, keys|
- keys = keys.join ' '
+ server_keys.each do |server, keys_for_server|
+ keys_for_server = keys_for_server.join ' '
values = if @multithread then
- threadsafe_cache_get_multi server, keys
+ threadsafe_cache_get_multi server, keys_for_server
else
- cache_get_multi server, keys
+ cache_get_multi server, keys_for_server
end
values.each do |key, value|
results[cache_keys[key]] = Marshal.load value
Please sign in to comment.
Something went wrong with that request. Please try again.