def parse_query(qs, d = '&;')
      params = {}
      (qs || '').split(/[#{d}] */n).each do |p|
        k, v = p.split('=', 2).map { |str| str } # NOTE: uri_unescape
        k = k.to_sym
        if cur = params[k]
          if cur.class == Array
            params[k] << v
          else
            params[k] = [cur, v]
          end
        else
          params[k] = v
        end
      end
      params
    end
def parse_query(qs, d = '&;')
      params = {}
      (qs || '').split(/[#{d}] */n).each do |p|
        k, v = p.split('=', 2).map { |str| str } # NOTE: uri_unescape
        k = k.to_sym
        if cur = params[k]
          if cur.class == Array
            params[k] << v
          else
            params[k] = [cur, v]
          end
        else
          params[k] = v
        end
      end
      params
    end
Based on / stolen from: https://github.com/chneukirchen/rack/blob/master/lib/rack/utils.rb
 which was based on / stolen from Mongrel