summaryrefslogtreecommitdiffstats
path: root/pyload/network/CookieJar.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/network/CookieJar.py')
-rw-r--r--pyload/network/CookieJar.py16
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