# File lib/rack/request.rb, line 251 def cookies hash = @env["rack.request.cookie_hash"] ||= {} string = @env["HTTP_COOKIE"] return hash if string == @env["rack.request.cookie_string"] hash.clear # According to RFC 2109: # If multiple cookies satisfy the criteria above, they are ordered in # the Cookie header such that those with more specific Path attributes # precede those with less specific. Ordering with respect to other # attributes (e.g., Domain) is unspecified. Utils.parse_query(string, ';,').each { |k,v| hash[k] = Array === v ? v.first : v } @env["rack.request.cookie_string"] = string hash rescue => error error.message.replace "cannot parse Cookie header: #{error.message}" raise end