diff options
author | Koch Michael <charlie8913@gmail.com> | 2014-05-31 22:10:29 +0200 |
---|---|---|
committer | Koch Michael <charlie8913@gmail.com> | 2014-05-31 22:10:29 +0200 |
commit | 85526434c8ee9947715f76cd4de99e6839e1470c (patch) | |
tree | b82c2e08b77a0e8a7b6654f7cacfb57e01184208 | |
parent | fixed downloads (diff) | |
download | pyload-85526434c8ee9947715f76cd4de99e6839e1470c.tar.xz |
Fix cookie issues
The Account-Page didn't show any Values on 'Traffic left' and 'Valid
until' for my Premium Account. Therefore no premium download was
possible. The Problem occured on ArchLinux and FreeBSD, but somehow not
on Ubuntu.
The Trick is to set the value for 'expires' as type int when it is just
a number.
-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 |