summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2014-06-01 12:16:44 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2014-06-01 12:16:44 +0200
commit8235e3ad46b70b17d10375ccc49405dc8730fd1a (patch)
treeb82c2e08b77a0e8a7b6654f7cacfb57e01184208
parentfixed downloads (diff)
parentFix cookie issues (diff)
downloadpyload-8235e3ad46b70b17d10375ccc49405dc8730fd1a.tar.xz
Merge pull request #642 from charlie89/fix-cookies
Fix cookie issues
-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