title: Ruby Error RangeError when post file
body: <p>I have an error "RangeError: RangeError" when I post a file throught my webservice.</p>
  
  <ol>
  <li>Sinatra version : sinatra (1.4.7) </li>
  <li>Ruby version : 2.3.1</li>
  </ol>
  
  <p>See the error stack below:</p>
  
  <p>RangeError: RangeError</p>
  
  <pre><code>    /home/greg/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/utils.rb:135:in `normalize_params'
      /home/greg/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/utils.rb:163:in `normalize_params'
      /home/greg/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/utils.rb:122:in `block in parse_nested_query'
      /home/greg/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/utils.rb:119:in `each'
      /home/greg/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/utils.rb:119:in `parse_nested_query'
      /home/greg/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/request.rb:371:in `parse_query'
      /home/greg/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/request.rb:215:in `POST'
      /home/greg/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/methodoverride.rb:39:in `method_override_param'
      /home/greg/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/methodoverride.rb:27:in `method_override'
      /home/greg/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/methodoverride.rb:15:in `call'
      /home/greg/.rvm/gems/ruby-2.3.1/gems/sinatra-1.4.7/lib/sinatra/show_exceptions.rb:25:in `call'
      /home/greg/.rvm/gems/ruby-2.3.1/gems/sinatra-1.4.7/lib/sinatra/base.rb:182:in `call'
      /home/greg/.rvm/gems/ruby-2.3.1/gems/sinatra-1.4.7/lib/sinatra/base.rb:2013:in `call'
      /home/greg/.rvm/gems/ruby-2.3.1/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:in `block in call'
      /home/greg/.rvm/gems/ruby-2.3.1/gems/sinatra-1.4.7/lib/sinatra/base.rb:1787:in `synchronize'
      /home/greg/.rvm/gems/ruby-2.3.1/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:in `call'
      /home/greg/.rvm/gems/ruby-2.3.1/gems/thin-1.7.0/lib/thin/connection.rb:86:in `block in pre_process'
      /home/greg/.rvm/gems/ruby-2.3.1/gems/thin-1.7.0/lib/thin/connection.rb:84:in `catch'
      /home/greg/.rvm/gems/ruby-2.3.1/gems/thin-1.7.0/lib/thin/connection.rb:84:in `pre_process'
      /home/greg/.rvm/gems/ruby-2.3.1/gems/thin-1.7.0/lib/thin/connection.rb:50:in `block in process'
  </code></pre>
  
  <p>See the code used below:</p>
  
  <pre><code>require 'rubygems'
  require 'sinatra'
  
  set :bind, '127.0.0.1'
  set :port, '4567'
  
  post '/test' do
  
    body "Hello"
    status 202
    return
  
  end
  </code></pre>
  
  <p>See the file posted below:</p>
  
  <pre><code>{
    "caller":"TEST",
    "c1": [ { "a" : ["b" ] } ],
    "c2": [ { "a" : ["b" ] } ],
    "c3": [ { "a" : ["b" ] } ],
    "c4": [ { "a" : ["b" ] } ],
    "c5": [ { "a" : ["b" ] } ],
    "c6": [ { "a" : ["b" ] } ],
    "c7": [ { "a" : ["b" ] } ],
    "c8": [ { "a" : ["b" ] } ],
    "c9": [ { "a" : ["b" ] } ],
    "c10": [ { "a" : ["b" ] } ],
    "c11": [ { "a" : ["b" ] } ],
    "c12": [ { "a" : ["b" ] } ],
    "c13": [ { "a" : ["b" ] } ],
    "c14": [ { "a" : ["b" ] } ],
    "c15": [ { "a" : ["b" ] } ],
    "c16": [ { "a" : ["b" ] } ],
    "c17": [ { "a" : ["b" ] } ],
    "c18": [ { "a" : ["b" ] } ],
    "c19": [ { "a" : ["b" ] } ],
    "c20": [ { "a" : ["b" ] } ],
    "c21": [ { "a" : ["b" ] } ],
    "c22": [ { "a" : ["b" ] } ],
    "c23": [ { "a" : ["b" ] } ],
    "c24": [ { "a" : ["b" ] } ],
    "c25": [ { "a" : ["b" ] } ]
  }
  </code></pre>
  
  <p>See the command used to post my file below:</p>
  
  <pre><code>curl -v -H 'Accept: application/text' -X POST http://127.0.0.1:4567/test -d @$1
  </code></pre>
  
  <p>I think the problem is the JSON structure.</p>
  
  <p>I try to post this JSON in PHP server, Python, and Java server and it works.</p>
  
  <p>The limitation of the number of array is probably due to Sinatra framework.
  When I post a file with 49 arrays it work, but more than 50 it fail.</p>
  
  <p>Thanks in advance.</p>