Merge branch 'master' into kikeflare

This commit is contained in:
Thomas Lynch
2023-01-06 19:14:21 +11:00
2 changed files with 9 additions and 2 deletions

View File

@@ -2,7 +2,7 @@ global
daemon
maxconn 256
log stdout format raw local0 debug
lua-load /etc/haproxy/scripts/register.lua
lua-load-per-thread /etc/haproxy/scripts/register.lua
stats socket /var/run/haproxy.sock mode 666 level admin
stats socket 127.0.0.1:1999 level admin
httpclient.ssl.verify none

View File

@@ -11,11 +11,12 @@ local SEMICOLON = byte(";")
local SPACE = byte(" ")
local HTAB = byte("\t")
local MAX_LEN = 10 * 1024 -- in case you are a dumbass and set a high tune.maxrewrite
local MAX_COOKIES = 100
local _M = {}
_M._VERSION = '0.01'
function _M.get_cookie_table(text_cookie)
if type(text_cookie) ~= "string" then
return {}
@@ -27,10 +28,16 @@ function _M.get_cookie_table(text_cookie)
local n = 0
local len = #text_cookie
if len > MAX_LEN then
return {}
end
for i=1, len do
if byte(text_cookie, i) == SEMICOLON then
n = n + 1
if n > MAX_COOKIES then
return {}
end
end
end