diff -r 98376cf9133d Lib/http/cookiejar.py --- a/Lib/http/cookiejar.py Tue Jan 06 22:16:10 2015 -0800 +++ b/Lib/http/cookiejar.py Wed Jan 07 11:21:12 2015 +0100 @@ -2016,7 +2016,8 @@ assert domain_specified == initial_dot discard = False - if expires == "": + # curl and Wget set expires to 0 for session cookies. + if expires == "0" or expires == "": expires = None discard = True @@ -2064,7 +2065,7 @@ if cookie.expires is not None: expires = str(cookie.expires) else: - expires = "" + expires = "0" if cookie.value is None: # cookies.txt regards 'Set-Cookie: foo' as a cookie # with no name, whereas http.cookiejar regards it as a