diff options
author | José Valim <jose.valim@plataformatec.com.br> | 2012-02-17 01:52:55 -0800 |
---|---|---|
committer | José Valim <jose.valim@plataformatec.com.br> | 2012-02-17 01:52:55 -0800 |
commit | 45503ecbb998a317a266e66cf8c55bfe55951719 (patch) | |
tree | 4f55603eef3da63cd2d257a794da31b5a91fdcbf /actionpack/lib | |
parent | a1b9acb72ec4b3a3d11f77efe64effb79e58b45d (diff) | |
parent | dffd85a1922d4169311f98d7560564d4356f8631 (diff) | |
download | rails-45503ecbb998a317a266e66cf8c55bfe55951719.tar.gz rails-45503ecbb998a317a266e66cf8c55bfe55951719.tar.bz2 rails-45503ecbb998a317a266e66cf8c55bfe55951719.zip |
Merge pull request #5073 from asanghi/4918_backport
Backporting #4918 with one added test for googlebot accept header as I saw it
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/http/mime_type.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/http/mime_type.rb b/actionpack/lib/action_dispatch/http/mime_type.rb index 25affb9f50..2152351703 100644 --- a/actionpack/lib/action_dispatch/http/mime_type.rb +++ b/actionpack/lib/action_dispatch/http/mime_type.rb @@ -82,6 +82,7 @@ module Mime class << self TRAILING_STAR_REGEXP = /(text|application)\/\*/ + Q_SEPARATOR_REGEXP = /;\s*q=/ def lookup(string) LOOKUP[string] @@ -108,6 +109,7 @@ module Mime def parse(accept_header) if accept_header !~ /,/ + accept_header = accept_header.split(Q_SEPARATOR_REGEXP).first if accept_header =~ TRAILING_STAR_REGEXP parse_data_with_trailing_star($1) else @@ -117,7 +119,7 @@ module Mime # keep track of creation order to keep the subsequent sort stable list, index = [], 0 accept_header.split(/,/).each do |header| - params, q = header.split(/;\s*q=/) + params, q = header.split(Q_SEPARATOR_REGEXP) if params.present? params.strip! |