Skip to content
Myr

Use calendar.timegm when calculating cookie expiration

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fixes #1859

authored by Ian Cordasco · committed by Ian Cordasco · parent ac4e058 · Browse files · 1 file+3 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Credit: @lukasa

Diff stats

1 file+3 added−2 removed

  • other:+3 added−2 removed

1 file+3 added−2 removed

modified:requests/cookies.py+3 added-2 removed
5 unmodified lines
6requests.utils imports from here, so be careful with imports.7"""89import time10import calendar11import collections12from .compat import cookielib, urlparse, urlunparse, Morsel1314try:
378 unmodified lines
393 if morsel['max-age']:394 expires = time.time() + morsel['max-age']395 elif morsel['expires']:396 time_template = '%a, %d-%b-%Y %H:%M:%S GMT'396 expires = time.mktime(397 time.strptime(morsel['expires'], time_template)) - time.timezone397 expires = calendar.timegm(time.strptime(morsel['expires'],398 time_template))399 return create_cookie(400 comment=morsel['comment'],401 comment_url=bool(morsel['comment']),402 discard=False,
53 unmodified lines