diff options
-rw-r--r-- | pyload/network/CookieJar.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/pyload/network/CookieJar.py b/pyload/network/CookieJar.py index 3d39c66b9..42ccdcafc 100644 --- a/pyload/network/CookieJar.py +++ b/pyload/network/CookieJar.py @@ -9,11 +9,21 @@ class CookieJar(SimpleCookie): return self[name].value def setCookie(self, domain, name, value, path="/", exp=None, secure="FALSE"): - if not exp: exp = time() + 3600 * 24 * 180 - self[name] = value self[name]["domain"] = domain self[name]["path"] = path - self[name]["expires"] = exp + + #Value of expires should be integer if possible + # otherwise the cookie won't be used + expire=0 + if not exp: + expires = time() + 3600 * 24 * 180 + else: + try: + expires = int(exp) + except ValueError: + expires = exp + + self[name]["expires"] = expires if secure == "TRUE": self[name]["secure"] = secure |