mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-09 09:00:58 +00:00
Added equality check for Cookies, and use that to augment the retrieved cookies.
This commit is contained in:
parent
2a7292845c
commit
415efe262e
2 changed files with 5 additions and 4 deletions
2
linkcheck/cache/cookie.py
vendored
2
linkcheck/cache/cookie.py
vendored
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue