mirror of
https://github.com/openappsec/attachment.git
synced 2025-11-15 17:02:15 +03:00
fixing multi headers valus issue in kong
This commit is contained in:
@@ -184,7 +184,6 @@ function nano.init_attachment()
|
|||||||
for attempt = 1, retries do
|
for attempt = 1, retries do
|
||||||
attachment, err = nano_attachment.init_nano_attachment(worker_id, nano.num_workers)
|
attachment, err = nano_attachment.init_nano_attachment(worker_id, nano.num_workers)
|
||||||
if attachment then
|
if attachment then
|
||||||
kong.log.info("Worker ", worker_id, " successfully initialized attachment on attempt ", attempt)
|
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -277,11 +276,19 @@ function nano.handleHeaders(headers)
|
|||||||
goto continue
|
goto continue
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Convert ":authority" to "Host"
|
|
||||||
if key == ":authority" then key = "Host" end
|
if key == ":authority" then key = "Host" end
|
||||||
|
|
||||||
-- Store header data in C memory
|
-- Handle multiple header values (Kong represents them as tables)
|
||||||
nano_attachment.setHeaderElement(header_data, index, key, value)
|
local header_value = value
|
||||||
|
if type(value) == "table" then
|
||||||
|
kong.log.debug("Header '", key, "' has multiple values: ", table.concat(value, ", "))
|
||||||
|
header_value = table.concat(value, ", ")
|
||||||
|
elseif type(value) ~= "string" then
|
||||||
|
kong.log.warn("Header '", key, "' has unexpected type: ", type(value), " - converting to string")
|
||||||
|
header_value = tostring(value)
|
||||||
|
end
|
||||||
|
|
||||||
|
nano_attachment.setHeaderElement(header_data, index, key, header_value)
|
||||||
index = index + 1
|
index = index + 1
|
||||||
|
|
||||||
::continue::
|
::continue::
|
||||||
|
|||||||
Reference in New Issue
Block a user