File tree Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,11 @@ Creates and returns a copy of a store.
1717Add new directives to the store about the given ` host ` . ` directives ` should be a table of directives, which * must* include the key ` "max-age" ` .
1818
1919
20+ ### ` hsts_store:remove(host) ` <!-- --> {#http.hsts: remove }
21+
22+ Removes the entry for ` host ` from the store (if it exists).
23+
24+
2025### ` hsts_store:check(host) ` <!-- --> {#http.hsts: check }
2126
2227Returns a boolean indicating if the given ` host ` is a known HSTS host.
Original file line number Diff line number Diff line change @@ -49,17 +49,13 @@ function store_methods:store(host, directives)
4949 else
5050 max_age = tonumber (max_age , 10 )
5151 end
52- if http_util .is_ip (host ) then
53- return false
54- end
52+
5553 if max_age == 0 then
56- -- delete from store
57- local item = self .domains [host ]
58- if item then
59- self .expiry_heap :remove (item )
60- self .domains [host ] = nil
61- end
54+ return self :remove (host )
6255 else
56+ if http_util .is_ip (host ) then
57+ return false
58+ end
6359 -- add to store
6460 local old_item = self .domains [host ]
6561 if old_item then
@@ -77,6 +73,15 @@ function store_methods:store(host, directives)
7773 return true
7874end
7975
76+ function store_methods :remove (host )
77+ local item = self .domains [host ]
78+ if item then
79+ self .expiry_heap :remove (item )
80+ self .domains [host ] = nil
81+ end
82+ return true
83+ end
84+
8085function store_methods :check (host )
8186 if http_util .is_ip (host ) then
8287 return false
You can’t perform that action at this time.
0 commit comments