aboutsummaryrefslogtreecommitdiffstats
path: root/modules/host/egress.lua
diff options
context:
space:
mode:
Diffstat (limited to 'modules/host/egress.lua')
-rw-r--r--modules/host/egress.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/host/egress.lua b/modules/host/egress.lua
index 6875608..6c507a1 100644
--- a/modules/host/egress.lua
+++ b/modules/host/egress.lua
@@ -31,7 +31,10 @@ local function rules(user)
if not f then
return domains, paths
end
- for line in f:lines() do
+ -- Only the first 64k, so a huge file can't slow down everyone's egress.
+ local text = f:read(65536) or ""
+ f:close()
+ for line in text:gmatch("[^\n]+") do
local domain, path = line:match("^%s*([^/%s]+)(/?%S*)%s*$")
if valid_name(domain) then
if path == "" then
@@ -42,7 +45,6 @@ local function rules(user)
end
end
end
- f:close()
return domains, paths
end