-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patch rack-accept to support all valid RFC6838 characters in media types
- Loading branch information
Showing
9 changed files
with
52 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
# This file was generated by Appraisal | ||
|
||
source 'https://rubygems.org' | ||
source "https://rubygems.org" | ||
|
||
gem 'rack', '1.5.2' | ||
gem "rack", "1.5.2" | ||
|
||
group :development, :test do | ||
gem 'rubocop', '~> 0.31.0' | ||
gem 'guard' | ||
gem 'guard-rspec' | ||
gem 'guard-rubocop' | ||
gem "rubocop", "0.33.0" | ||
gem "guard" | ||
gem "guard-rspec" | ||
gem "guard-rubocop" | ||
end | ||
|
||
gemspec :path => '../' | ||
gemspec :path => "../" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
# This file was generated by Appraisal | ||
|
||
source 'https://rubygems.org' | ||
source "https://rubygems.org" | ||
|
||
gem 'rails', '3.2.19' | ||
gem "rails", "3.2.19" | ||
gem "rack-cache", "<= 1.2" | ||
|
||
group :development, :test do | ||
gem 'rubocop', '~> 0.31.0' | ||
gem 'guard' | ||
gem 'guard-rspec' | ||
gem 'guard-rubocop' | ||
gem "rubocop", "0.33.0" | ||
gem "guard" | ||
gem "guard-rspec" | ||
gem "guard-rubocop" | ||
end | ||
|
||
gemspec :path => '../' | ||
gemspec :path => "../" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
# This file was generated by Appraisal | ||
|
||
source 'https://rubygems.org' | ||
source "https://rubygems.org" | ||
|
||
gem 'rails', '4.1.6' | ||
gem "rails", "4.1.6" | ||
|
||
group :development, :test do | ||
gem 'rubocop', '~> 0.31.0' | ||
gem 'guard' | ||
gem 'guard-rspec' | ||
gem 'guard-rubocop' | ||
gem "rubocop", "0.33.0" | ||
gem "guard" | ||
gem "guard-rspec" | ||
gem "guard-rubocop" | ||
end | ||
|
||
gemspec :path => '../' | ||
gemspec :path => "../" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Rack | ||
module Accept | ||
module Header | ||
class << self | ||
# Corrected version of https://github.com/mjackson/rack-accept/blob/master/lib/rack/accept/header.rb#L40-L44 | ||
def parse_media_type(media_type) | ||
# see http://tools.ietf.org/html/rfc6838#section-4.2 for allowed characters in media type names | ||
m = media_type.to_s.match(%r{^([a-z*]+)\/([a-z0-9*\&\^\-_#\$!.+]+)(?:;([a-z0-9=;]+))?$}) | ||
m ? [m[1], m[2], m[3] || ''] : [] | ||
end | ||
end | ||
end | ||
|
||
class MediaType | ||
def parse_media_type(media_type) | ||
Header.parse_media_type(media_type) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters