Permalink
Browse files

removed parsing of quoted values

  • Loading branch information...
thinkerbot authored and manveru committed May 14, 2010
1 parent 609ecd5 commit dae12e088592ee69545b5f2f81b87f4959859164
Showing with 2 additions and 8 deletions.
  1. +0 −6 lib/rack/utils.rb
  2. +2 −2 test/spec_rack_utils.rb
@@ -39,9 +39,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
@@ -70,9 +67,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 = $' || ''
@@ -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").
@@ -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"

1 comment on commit dae12e0

@Mange

This comment has been minimized.

Copy link

Mange commented on dae12e0 Jul 30, 2010

Wonderful! :-)

Please sign in to comment.