test/spec_utils.rb in rack-1.5.3 vs test/spec_utils.rb in rack-1.5.4

- old
+ new

@@ -121,9 +121,21 @@ Rack::Utils.parse_query(",key,", ";,").should.equal "key" => nil Rack::Utils.parse_query(";foo=bar,;", ";,").should.equal "foo" => "bar" Rack::Utils.parse_query(",foo=bar;,", ";,").should.equal "foo" => "bar" end + should "raise an exception if the params are too deep" do + len = Rack::Utils.param_depth_limit + + lambda { + Rack::Utils.parse_nested_query("foo#{"[a]" * len}=bar") + }.should.raise(RangeError) + + lambda { + Rack::Utils.parse_nested_query("foo#{"[a]" * (len - 1)}=bar") + }.should.not.raise + end + should "parse nested query strings correctly" do Rack::Utils.parse_nested_query("foo"). should.equal "foo" => nil Rack::Utils.parse_nested_query("foo="). should.equal "foo" => ""