class Rack::Test::Cookie

def initialize(raw, uri = nil, default_host = DEFAULT_HOST)

def initialize(raw, uri = nil, default_host = DEFAULT_HOST)
  @default_host = default_host
  uri ||= default_uri
  # separate the name / value pair from the cookie options
  @raw, options = raw.split(/[;,] */n, 2)
  @name, @value = parse_query(@raw, ';').to_a.first
  @options = Hash[parse_query(options, ';').map { |k, v| [k.downcase, v] }]
  if domain = @options['domain']
    @exact_domain_match = false
    domain[0] = '' if domain[0] == '.'
  else
    # If the domain attribute is not present in the cookie,
    # the domain must match exactly.
    @exact_domain_match = true
    @options['domain'] = (uri.host || default_host)
  end
  # Set the path for the cookie to the directory containing
  # the request if it isn't set.
  @options['path'] ||= uri.path.sub(/\/[^\/]*\Z/, '')
end