# File lib/rack/utils.rb, line 206defparse_cookies_header(header)
# 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.cookies = parse_query(header, ';,') { |s|unescape(s) rescues }
cookies.each_with_object({}) { |(k,v), hash|hash[k] = Array===v?v.first:v }
end

Modified version of stdlib time.rb Time#rfc2822 to use '%d-%b-%Y'
instead of '% %b %Y'. It assumes that the time is in GMT to comply
to the RFC 2109.

NOTE: I'm not sure the RFC says it requires GMT, but is ambiguous
enough that I'm certain someone implemented only that option. Do not
use %a and %b from Time.strptime, it would use localized names for weekday
and month.

NOTE: the values compared should be of fixed length, such as strings that
have already been processed by HMAC. This should not be used on variable
length plaintext strings because it could leak length info via timing
attacks.