method
parse_set_cookie
v2_1_10 -
Show latest stable
- Class:
WEBrick::Cookie
parse_set_cookie(str)public
Parses the cookie in str
# File lib/webrick/cookie.rb, line 137
def self.parse_set_cookie(str)
cookie_elem = str.split(/;/)
first_elem = cookie_elem.shift
first_elem.strip!
key, value = first_elem.split(/=/, 2)
cookie = new(key, HTTPUtils.dequote(value))
cookie_elem.each{|pair|
pair.strip!
key, value = pair.split(/=/, 2)
if value
value = HTTPUtils.dequote(value.strip)
end
case key.downcase
when "domain" then cookie.domain = value
when "path" then cookie.path = value
when "expires" then cookie.expires = value
when "max-age" then cookie.max_age = Integer(value)
when "comment" then cookie.comment = value
when "version" then cookie.version = Integer(value)
when "secure" then cookie.secure = true
end
}
return cookie
end Related methods
- Instance methods
- expires
- expires=
- to_s
- Class methods
- new
- parse
- parse_set_cookie
- parse_set_cookies