File tree Expand file tree Collapse file tree 1 file changed +3
-14
lines changed Expand file tree Collapse file tree 1 file changed +3
-14
lines changed Original file line number Diff line number Diff line change @@ -3,10 +3,7 @@ Data structures useful for HSTS (HTTP Strict Transport Security)
33HSTS is described in RFC 6797
44]]
55
6- local EOF = require " lpeg" .P (- 1 )
7- local IPv4address = require " lpeg_patterns.IPv4" .IPv4address
8- local IPv6address = require " lpeg_patterns.IPv6" .IPv6address
9- local IPaddress = (IPv4address + IPv6address ) * EOF
6+ local http_util = require " http.util"
107
118local store_methods = {
129 time = function () return os.time () end ;
@@ -23,14 +20,6 @@ local store_item_mt = {
2320 __index = store_item_methods ;
2421}
2522
26- local function host_is_ip (host )
27- if IPaddress :match (host ) then
28- return true
29- else
30- return false
31- end
32- end
33-
3423local function new_store ()
3524 return setmetatable ({
3625 domains = {};
@@ -56,7 +45,7 @@ function store_methods:store(host, directives)
5645 else
5746 max_age = tonumber (max_age , 10 )
5847 end
59- if host_is_ip (host ) then
48+ if http_util . is_ip (host ) then
6049 return false
6150 end
6251 if max_age == 0 then
@@ -73,7 +62,7 @@ function store_methods:store(host, directives)
7362end
7463
7564function store_methods :check (host )
76- if host_is_ip (host ) then
65+ if http_util . is_ip (host ) then
7766 return false
7867 end
7968 local now = self .time ()
You can’t perform that action at this time.
0 commit comments