From 85526434c8ee9947715f76cd4de99e6839e1470c Mon Sep 17 00:00:00 2001 From: Koch Michael Date: Sat, 31 May 2014 22:10:29 +0200 Subject: 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. --- pyload/network/CookieJar.py | 16 +++++++++++++--- 1 file 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 -- cgit v1.2.3