diff options
-rw-r--r-- | README | 12 | ||||
-rw-r--r-- | bulkredirect.lua | 23 |
2 files changed, 19 insertions, 16 deletions
@@ -47,8 +47,7 @@ haproxy. By default, the library reads redirection table from the file '/etc/haproxy/bulkredirect.rt'. Another file name can be supplied via -the HAPROXY_BULKREDIRECT environment variable. Unless it ends with a -'.lua' suffix, it will be parsed as a plain text redirection table. +the HAPROXY_BULKREDIRECT environment variable. Each line in a redirection table file is either a comment or a statement. A comment begins with a '#' character as first @@ -69,6 +68,9 @@ apply. Syntactically, it is: where DOMAIN is the domain name. No whitespace is allowed between the name and square brackets. +If the 'lua-idna' library is available[1], the DOMAIN can be a UTF-8 +string. It will be converted to the appropriate ASCII form automatically. + Each domain declaration remains in effect until another domain declaration is encountered in the redirection table. @@ -79,7 +81,7 @@ A redirection table file must declare at least one domain. ** Option definition Option definition begins with the word 'option' followed by one or -more option names, delimited with commas. An option name is: +more option names, delimited with commas. Valid option names are: *** www @@ -193,6 +195,10 @@ Please, send bug reports and suggestions to: Sergey Poznyakoff <gray@gnu.org> +* References + +[1] https://puszcza.gnu.org.ua/projects/lua-idna + * Copyright Copyright (C) 2021 Sergey Poznyakoff diff --git a/bulkredirect.lua b/bulkredirect.lua index ef7befb..44917fb 100644 --- a/bulkredirect.lua +++ b/bulkredirect.lua @@ -508,20 +508,17 @@ local function load_redirect_table () if name == nil then name = '/etc/haproxy/bulkredirect.rt' end - if name:match('%.lua$') then - rt, rtflags = dofile(name) - else - local file, err = io.open(name,"r") - if file ~= nil then - local status, err = pcall(load_redirect_file, file, name) - file:close() - if not status then - core.Alert(err) - end - -- print(require('inspect')(rt)) - else - core.Alert("can't open " .. name .. ": " .. err) + + local file, err = io.open(name,"r") + if file ~= nil then + local status, err = pcall(load_redirect_file, file, name) + file:close() + if not status then + core.Alert(err) end + -- print(require('inspect')(rt)) + else + core.Alert("can't open " .. name .. ": " .. err) end end |