mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-15 12:40:25 +00:00
Merge branch 'cookie-expire-fix' of https://github.com/klaar/cowboy
This commit is contained in:
commit
5d46ad0e58
1 changed files with 14 additions and 1 deletions
|
@ -64,7 +64,20 @@ rfc2109(LocalTime) ->
|
||||||
{{YYYY,MM,DD},{Hour,Min,Sec}} =
|
{{YYYY,MM,DD},{Hour,Min,Sec}} =
|
||||||
case calendar:local_time_to_universal_time_dst(LocalTime) of
|
case calendar:local_time_to_universal_time_dst(LocalTime) of
|
||||||
[Gmt] -> Gmt;
|
[Gmt] -> Gmt;
|
||||||
[_,Gmt] -> Gmt
|
[_,Gmt] -> Gmt;
|
||||||
|
[] ->
|
||||||
|
%% The localtime generated by cowboy_cookies may fall within
|
||||||
|
%% the hour that is skipped by daylight savings time. If this
|
||||||
|
%% is such a localtime, increment the localtime with one hour
|
||||||
|
%% and try again, if this succeeds, subtracting the max_age
|
||||||
|
%% from the resulting universaltime and converting to a local
|
||||||
|
%% time will yield the original localtime.
|
||||||
|
{Date, {Hour1, Min1, Sec1}} = LocalTime,
|
||||||
|
LocalTime2 = {Date, {Hour1 + 1, Min1, Sec1}},
|
||||||
|
case calendar:local_time_to_universal_time_dst(LocalTime2) of
|
||||||
|
[Gmt] -> Gmt;
|
||||||
|
[_,Gmt] -> Gmt
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
Wday = calendar:day_of_the_week({YYYY,MM,DD}),
|
Wday = calendar:day_of_the_week({YYYY,MM,DD}),
|
||||||
DayBin = pad_int(DD),
|
DayBin = pad_int(DD),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue