mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
Use calendar.timegm when calculating cookie expiration
Fixes #1859 Credit: @lukasa
This commit is contained in:
+3
-2
@@ -7,6 +7,7 @@ requests.utils imports from here, so be careful with imports.
|
||||
"""
|
||||
|
||||
import time
|
||||
import calendar
|
||||
import collections
|
||||
from .compat import cookielib, urlparse, urlunparse, Morsel
|
||||
|
||||
@@ -393,8 +394,8 @@ def morsel_to_cookie(morsel):
|
||||
expires = time.time() + morsel['max-age']
|
||||
elif morsel['expires']:
|
||||
time_template = '%a, %d-%b-%Y %H:%M:%S GMT'
|
||||
expires = time.mktime(
|
||||
time.strptime(morsel['expires'], time_template)) - time.timezone
|
||||
expires = calendar.timegm(time.strptime(morsel['expires'],
|
||||
time_template))
|
||||
return create_cookie(
|
||||
comment=morsel['comment'],
|
||||
comment_url=bool(morsel['comment']),
|
||||
|
||||
Reference in New Issue
Block a user