Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
removed parsing of quoted values
Signed-off-by: raggi <jftucker@gmail.com>
  • Loading branch information
thinkerbot authored and raggi committed Dec 19, 2010
1 parent e6ebd83 commit 6fa19e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
6 changes: 0 additions & 6 deletions lib/rack/utils.rb
Expand Up @@ -38,9 +38,6 @@ def parse_query(qs, d = nil)

(qs || '').split(d ? /[#{d}] */n : DEFAULT_SEP).each do |p|
k, v = p.split('=', 2).map { |x| unescape(x) }
if v =~ /^("|')(.*)\1$/
v = $2.gsub('\\'+$1, $1)
end
if cur = params[k]
if cur.class == Array
params[k] << v
Expand Down Expand Up @@ -69,9 +66,6 @@ def parse_nested_query(qs, d = nil)
module_function :parse_nested_query

def normalize_params(params, name, v = nil)
if v and v =~ /^("|')(.*)\1$/
v = $2.gsub('\\'+$1, $1)
end
name =~ %r(\A[\[\]]*([^\[\]]+)\]*)
k = $1 || ''
after = $' || ''
Expand Down
4 changes: 2 additions & 2 deletions test/spec_rack_utils.rb
Expand Up @@ -33,7 +33,7 @@
Rack::Utils.parse_query("foo=bar").
should.equal "foo" => "bar"
Rack::Utils.parse_query("foo=\"bar\"").
should.equal "foo" => "bar"
should.equal "foo" => "\"bar\""
Rack::Utils.parse_query("foo=bar&foo=quux").
should.equal "foo" => ["bar", "quux"]
Rack::Utils.parse_query("foo=1&bar=2").
Expand All @@ -51,7 +51,7 @@
Rack::Utils.parse_nested_query("foo=bar").
should.equal "foo" => "bar"
Rack::Utils.parse_nested_query("foo=\"bar\"").
should.equal "foo" => "bar"
should.equal "foo" => "\"bar\""

Rack::Utils.parse_nested_query("foo=bar&foo=quux").
should.equal "foo" => "quux"
Expand Down

0 comments on commit 6fa19e3

Please sign in to comment.