diff --git a/linkcheck/cache/cookie.py b/linkcheck/cache/cookie.py index 76cb2bea..46d3be37 100644 --- a/linkcheck/cache/cookie.py +++ b/linkcheck/cache/cookie.py @@ -36,7 +36,7 @@ class CookieJar (object): @synchronized(_lock) def add (self, headers, scheme, host, path): """Parse cookie values, add to cache.""" - jar = set() + jar = self.cache.setdefault(host, set()) for h in headers.getallmatchingheaders("Set-Cookie"): # RFC 2109 (Netscape) cookie type try: diff --git a/linkcheck/cookies.py b/linkcheck/cookies.py index 64e402e3..f9a48c10 100644 --- a/linkcheck/cookies.py +++ b/linkcheck/cookies.py @@ -279,6 +279,10 @@ class HttpCookie (object): for k, v in self.attributes.items() if k != "version"]) return "; ".join(parts) + def __eq__ (self, other): + return isinstance(other, HttpCookie) and \ + self.server_header_value() == other.server_header_value() + class NetscapeCookie (HttpCookie): """Parses RFC 2109 (Netscape) cookies.""" @@ -312,9 +316,6 @@ class Rfc2965Cookie (HttpCookie): return quote(value) -# XXX more methods (equality test) - - def from_file (filename): """Parse cookie data from a text file in HTTP header format.