module Rack::Utils

def parse_cookies_header(value)


# => {"myname"=>"myvalue", "max-age"=>"0"}
parse_cookies_header('myname=myvalue; max-age=0')

cookie +key+ to cookie +value+.
syntax for cookie headers only supports semicolons. Returns a map of
Parse cookies from the provided header +value+ according to RFC6265. The

parse_cookies_header(value) -> hash
:call-seq:
def parse_cookies_header(value)
  return {} unless value
  value.split(/; */n).each_with_object({}) do |cookie, cookies|
    next if cookie.empty?
    key, value = cookie.split('=', 2)
    cookies[key] = (unescape(value) rescue value) unless cookies.key?(key)
  end
end