module Puma::Util
def parse_query(qs, d = nil, &unescaper)
cookies by changing the characters used in the second
and ';' characters. You can also use this to parse
Parses a query string by breaking it up at the '&'
Stolen from Mongrel, with some small modifications:
def parse_query(qs, d = nil, &unescaper) unescaper ||= method(:unescape) params = {} (qs || '').split(d ? /[#{d}] */n : DEFAULT_SEP).each do |p| next if p.empty? k, v = p.split('=', 2).map(&unescaper) 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