diff options
author | Matthew Draper <matthew@trebex.net> | 2015-06-19 06:49:42 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2015-06-19 06:49:42 +0930 |
commit | cb9a68493b5a17a35c31b2c8cbacd81d5b0e4fae (patch) | |
tree | 4136de320f38534c89d59467b455909a203f2f1f | |
parent | 9ca798fd67bae63143ca2345dd8278d6ffdfd7e5 (diff) | |
download | rack-cb9a68493b5a17a35c31b2c8cbacd81d5b0e4fae.tar.gz |
Revert "Merge pull request #781 from Nyoho/fix-separator-semicolon-GET"
This reverts commit 75c65fbb3b4a907ef3ebf5e97d0270918607a357.
-rw-r--r-- | lib/rack/request.rb | 8 | ||||
-rw-r--r-- | test/spec_request.rb | 23 |
2 files changed, 10 insertions, 21 deletions
diff --git a/lib/rack/request.rb b/lib/rack/request.rb index 6e00285e..e6e46e9d 100644 --- a/lib/rack/request.rb +++ b/lib/rack/request.rb @@ -188,7 +188,7 @@ module Rack if @env["rack.request.query_string"] == query_string @env["rack.request.query_hash"] else - p = parse_query(query_string, '&;') + p = parse_query(query_string) @env["rack.request.query_string"] = query_string @env["rack.request.query_hash"] = p end @@ -212,7 +212,7 @@ module Rack form_vars.slice!(-1) if form_vars[-1] == ?\0 @env["rack.request.form_vars"] = form_vars - @env["rack.request.form_hash"] = parse_query(form_vars, '&') + @env["rack.request.form_hash"] = parse_query(form_vars) @env["rack.input"].rewind end @@ -365,8 +365,8 @@ module Rack ip_addresses.reject { |ip| trusted_proxy?(ip) } end - def parse_query(qs, d='&') - Utils.parse_nested_query(qs, d) + def parse_query(qs) + Utils.parse_nested_query(qs, '&') end def parse_multipart(env) diff --git a/test/spec_request.rb b/test/spec_request.rb index e714af4c..6f379a0b 100644 --- a/test/spec_request.rb +++ b/test/spec_request.rb @@ -134,25 +134,14 @@ describe Rack::Request do req.params.should.equal "foo" => "bar", "quux" => "bla" end - should "not truncate query strings containing semi-colons #543 only in POST" do - mr = Rack::MockRequest.env_for("/", - "REQUEST_METHOD" => 'POST', - :input => "foo=bar&quux=b;la") - req = Rack::Request.new mr - req.query_string.should.equal "" - req.GET.should.be.empty - req.POST.should.equal "foo" => "bar", "quux" => "b;la" - req.params.should.equal req.GET.merge(req.POST) - end - - should "use semi-colons as separators for query strings in GET" do - req = Rack::Request.new(Rack::MockRequest.env_for("/?foo=bar&quux=b;la;wun=duh")) - req.query_string.should.equal "foo=bar&quux=b;la;wun=duh" - req.GET.should.equal "foo" => "bar", "quux" => "b", "la" => nil, "wun" => "duh" + should "not truncate query strings containing semi-colons #543" do + req = Rack::Request.new(Rack::MockRequest.env_for("/?foo=bar&quux=b;la")) + req.query_string.should.equal "foo=bar&quux=b;la" + req.GET.should.equal "foo" => "bar", "quux" => "b;la" req.POST.should.be.empty - req.params.should.equal "foo" => "bar", "quux" => "b", "la" => nil, "wun" => "duh" + req.params.should.equal "foo" => "bar", "quux" => "b;la" end - + should "limit the keys from the GET query string" do env = Rack::MockRequest.env_for("/?foo=bar") |