Created
June 5, 2012 19:40
-
-
Save purcell/2877275 to your computer and use it in GitHub Desktop.
Revisions
-
purcell created this gist
Jun 5, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ # Monkeypatch fix for https://github.com/rack/rack/issues/386 achieved by # applying https://github.com/rack/rack/commit/2dfe94071497678c15cfcd8e63663d92f82958e5 raise "remove this fix" if Gem.loaded_specs["rack"].version > Gem::Version.new("1.4.1") module Rack module Utils def parse_query(qs, d = nil) params = KeySpaceConstrainedParams.new (qs || '').split(d ? /[#{d}] */n : DEFAULT_SEP).each do |p| k, v = p.split('=', 2).map { |x| unescape(x) } next unless k || v if cur = params[k] if cur.class == Array params[k] << v else params[k] = [cur, v] end else params[k] = v end end return params.to_params_hash end class KeySpaceConstrainedParams def []=(key, value) @size += key.size if key && !@params.key?(key) raise RangeError, 'exceeded available parameter key space' if @size > @limit @params[key] = value end end end end