aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthe lemons <citrons@mondecitronne.com>2022-02-07 15:02:40 -0600
committerthe lemons <citrons@mondecitronne.com>2022-02-07 15:02:40 -0600
commit658139771dffb486ae4887038a76ad691ca1b153 (patch)
tree3900b1356285adb03965f26ccd63ff71bed510ab
parent1dd9fb662e14723fd171806915abf5198fc3983f (diff)
permit a wider range of values with #set
-rwxr-xr-xzzcxz.cgi15
1 files changed, 6 insertions, 9 deletions
diff --git a/zzcxz.cgi b/zzcxz.cgi
index c6c8de4..c7ec545 100755
--- a/zzcxz.cgi
+++ b/zzcxz.cgi
@@ -165,15 +165,12 @@ local function parse_directive(line, directives)
directives.redirect = redirect
elseif directive == "set" then
if args:match "^%s*$" then return end
- local flagname = args:match "^%s*(%w+)%s*$"
- local text = ""
- if not flagname then
- flagname, text = args:match "^%s*(%w+)%s*(%w+)%s*$"
- if not flagname or not text or utf8.len(text) > 1000 then
- return
- end
+ local flagname, text = args:match "^%s*(%w+)%s*(.-)%s*$"
+ if not flagname then return end
+ text = text or ""
+ if utf8.len(flagname) > 150 or utf8.len(text) > 1000 then
+ return
end
- if utf8.len(flagname) > 150 then return end
directives.flags_updated[flagname] = text
flags[flagname] = text
elseif directive == "unset" then
@@ -350,7 +347,7 @@ map["^/g/(%w%w%w%w%w)$"] = function(p)
for flagname, text in pairs(directives.flags_updated) do
if text then
table.insert(cookies,
- ('flag_%s=%s; secure; max-age=999999999999')
+ ('flag_%s=%s; max-age=999999999999')
:format(flagname, url_encode(text)))
else
-- clear the cookie by expiring it in the past