From 24eeb4d6a3be678d652247a4a862ffde037514da Mon Sep 17 00:00:00 2001 From: Stanislav Laznicka Date: Thu, 2 Mar 2017 09:11:34 +0100 Subject: Fix cookie with Max-Age processing When cookie has Max-Age set it tries to get expiration by adding to a timestamp. Without this patch the timestamp would be set to None and thus the addition of timestamp + max_age fails https://pagure.io/freeipa/issue/6718 Reviewed-By: Simo Sorce --- ipapython/cookie.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ipapython') diff --git a/ipapython/cookie.py b/ipapython/cookie.py index 57523a402..9797fc184 100644 --- a/ipapython/cookie.py +++ b/ipapython/cookie.py @@ -322,7 +322,8 @@ class Cookie(object): return cookies @classmethod - def get_named_cookie_from_string(cls, cookie_string, cookie_name, request_url=None): + def get_named_cookie_from_string(cls, cookie_string, cookie_name, + request_url=None, timestamp=None): ''' A cookie string may contain multiple cookies, parse the cookie string and return the last cookie in the string matching the @@ -344,6 +345,8 @@ class Cookie(object): if cookie.key == cookie_name: target_cookie = cookie + if timestamp is not None: + target_cookie.timestamp = timestamp if request_url is not None: target_cookie.normalize(request_url) return target_cookie -- cgit