- Cookie#acceptable? is added, which is called by such methods as
Cookie.parse and CookieJar#add.
- Cookie#origin= no longer raises ArgumentError just because it
conflicts with the domain.
- Cookie#origin= raises ArgumentError if it is given an object that is
not URI or string-like.
I made the uri parameter optional when I introduced the origin
attribute, but on second thought it should always be given.
I'm making the origin parameter fixed and mandatory again, but this
time it comes next to set_cookie. This order should look more natural
because the one that comes first is to be parsed.
Since Mechanize::Cookie.parse required the uri parameter to be a URI
object, backward compatibility is still possible.
Now #expire returns created_at + max_age when expires is nil.
Cookie.parse: the :date keyword is renamed to :created_at, and the
value is set to in parsed cookies via #created_at.
In YAML serialization, #max_age is stored.
This is a backout of what I've done previously. Expiration check is
better done in extraction where a user can optionally specify a base
date.
Add an internal method delete() to delete an existing cookie.
The leading dot itself should be meaningless since there is the second
field to tell if the cookie is issued for a domain and that was the
reason I once removed it, but on second thought it doesn't hurt to put
one.
The new parser is almost RFC 6265 compliant as the previous
implementation but has some extensions:
- It can parse double-quoted values with unsafe characters inside
escaped with the backslash.
- It parses a date value of the expires attribute in the way the RFC
describes, with an exception that it allows omission of the seconds
field. Some of the broken date representations that used to pass
are now treated as error and ignored.
- It can parse a Set-Cookie value that contains multiple cookie
definitions separated by comma, and commas put inside double quotes
are not mistaken as definition separator.