mirror of
https://github.com/chaitin/SafeLine.git
synced 2026-01-31 13:53:33 +08:00
feat: lua t1k 1.1.5
This commit is contained in:
@@ -16,6 +16,7 @@ local byte = string.byte
|
||||
local char = string.char
|
||||
local fmt = string.format
|
||||
local sub = string.sub
|
||||
local concat = table.concat
|
||||
|
||||
local ngx = ngx
|
||||
local nlog = ngx.log
|
||||
@@ -88,6 +89,13 @@ local function get_remote_addr(remote_addr_var, remote_addr_idx)
|
||||
return addr or ngx_var.remote_addr
|
||||
end
|
||||
|
||||
local function parse_v(v)
|
||||
if type(v) == "table" then
|
||||
return concat(v, ", ")
|
||||
end
|
||||
return tostring(v)
|
||||
end
|
||||
|
||||
local function build_header()
|
||||
local http_version = ngx_req.http_version()
|
||||
if http_version < 2.0 then
|
||||
@@ -101,13 +109,10 @@ local function build_header()
|
||||
end
|
||||
|
||||
local buf = buffer:new()
|
||||
buf:add(ngx_req.get_method())
|
||||
buf:add(" ")
|
||||
buf:add(ngx_var.request_uri)
|
||||
buf:add(fmt(" HTTP/%.1f\r\n", http_version))
|
||||
buf:add(fmt("%s %s HTTP/%.1f\r\n", ngx_req.get_method(), ngx_var.request_uri, http_version))
|
||||
|
||||
for k, v in pairs(headers) do
|
||||
buf:add(k .. ": " .. v .. "\r\n")
|
||||
buf:add(fmt("%s: %s\r\n", k, parse_v(v)))
|
||||
end
|
||||
buf:add("\r\n")
|
||||
|
||||
|
||||
32
sdk/lua-resty-t1k/rockspec/lua-resty-t1k-1.1.5-0.rockspec
Normal file
32
sdk/lua-resty-t1k/rockspec/lua-resty-t1k-1.1.5-0.rockspec
Normal file
@@ -0,0 +1,32 @@
|
||||
package = "lua-resty-t1k"
|
||||
version = "1.1.5-0"
|
||||
source = {
|
||||
url = "git://github.com/chaitin/lua-resty-t1k",
|
||||
tag = "v1.1.5"
|
||||
}
|
||||
|
||||
description = {
|
||||
summary = "Lua implementation of the T1K protocol for Chaitin SafeLine Web Application Firewall",
|
||||
detailed = [[
|
||||
Check https://waf-ce.chaitin.cn/ for more information about Chaitin SafeLine Web Application Firewall.
|
||||
]],
|
||||
homepage = "https://github.com/chaitin/lua-resty-t1k",
|
||||
license = "Apache License 2.0",
|
||||
maintainer = "Xudong Wang <xudong.wang@chaitin.com>"
|
||||
}
|
||||
|
||||
build = {
|
||||
type = "builtin",
|
||||
modules = {
|
||||
["resty.t1k"] = "lib/resty/t1k.lua",
|
||||
["resty.t1k.buffer"] = "lib/resty/t1k/buffer.lua",
|
||||
["resty.t1k.constants"] = "lib/resty/t1k/constants.lua",
|
||||
["resty.t1k.file"] = "lib/resty/t1k/file.lua",
|
||||
["resty.t1k.filter"] = "lib/resty/t1k/filter.lua",
|
||||
["resty.t1k.handler"] = "lib/resty/t1k/handler.lua",
|
||||
["resty.t1k.log"] = "lib/resty/t1k/log.lua",
|
||||
["resty.t1k.request"] = "lib/resty/t1k/request.lua",
|
||||
["resty.t1k.utils"] = "lib/resty/t1k/utils.lua",
|
||||
["resty.t1k.uuid"] = "lib/resty/t1k/uuid.lua",
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user