Skip to content

Commit 271a51a

Browse files
committed
http/cookie: minor optimisation 1e999 instead of math.huge
The lua compiler will turn it into a constant
1 parent 2afa644 commit 271a51a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

http/cookie.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ end
100100
local store_methods = {
101101
psl = default_psl;
102102
time = function() return os.time() end;
103-
max_cookie_length = math.huge;
103+
max_cookie_length = (1e999);
104104
}
105105

106106
local store_mt = {
@@ -133,7 +133,7 @@ function store_methods:store(req_domain, req_path, req_is_http, req_is_secure, r
133133
local cookie = setmetatable({
134134
name = name;
135135
value = value;
136-
expiry_time = math.huge;
136+
expiry_time = (1e999);
137137
domain = req_domain;
138138
path = nil;
139139
creation_time = now;
@@ -153,7 +153,7 @@ function store_methods:store(req_domain, req_path, req_is_http, req_is_secure, r
153153
max_age = tonumber(max_age, 10)
154154
cookie.persistent = true
155155
if max_age <= 0 then
156-
cookie.expiry_time = -math.huge
156+
cookie.expiry_time = (-1e999)
157157
else
158158
cookie.expiry_time = now + max_age
159159
end
@@ -586,7 +586,7 @@ end
586586
function store_methods:clean_due()
587587
local next_expiring = self.expiry_heap:peek()
588588
if not next_expiring then
589-
return math.huge
589+
return (1e999)
590590
end
591591
return next_expiring.expiry_time
592592
end

0 commit comments

Comments
 (0)