aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2021-03-19 11:59:59 +0200
committerSergey Poznyakoff <gray@gnu.org>2021-03-19 11:59:59 +0200
commit75c5188022f464f52b34de45015a4c60a92ac9fc (patch)
tree537f3161f7cc9b99289f41dc9a7b52a8f685ab5e
parent475d9d334049fa4f7e628cb41e033bf9c72ac39e (diff)
downloadhaproxy-bulkredirect-75c5188022f464f52b34de45015a4c60a92ac9fc.tar.gz
haproxy-bulkredirect-75c5188022f464f52b34de45015a4c60a92ac9fc.tar.bz2
Update the docsHEADmaster
* README: Update. * bulkredirect.lua: Remove legacy code for loading the redirection table in pure lua form.
-rw-r--r--README12
-rw-r--r--bulkredirect.lua23
2 files changed, 19 insertions, 16 deletions
diff --git a/README b/README
index 87da0e6..1d549cd 100644
--- a/README
+++ b/README
@@ -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

Return to:

Send suggestions and report system problems to the System administrator.