diff options
author | the lemons <citrons@mondecitronne.com> | 2022-02-07 15:02:40 -0600 |
---|---|---|
committer | the lemons <citrons@mondecitronne.com> | 2022-02-07 15:02:40 -0600 |
commit | 658139771dffb486ae4887038a76ad691ca1b153 (patch) | |
tree | 3900b1356285adb03965f26ccd63ff71bed510ab | |
parent | 1dd9fb662e14723fd171806915abf5198fc3983f (diff) |
permit a wider range of values with #set
-rwxr-xr-x | zzcxz.cgi | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -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 |