Skip to content

Commit

Permalink
coraza - fix bug when body is not buffered in file
Browse files Browse the repository at this point in the history
  • Loading branch information
fl0ppy-d1sk committed Aug 14, 2023
1 parent 5dc3fd8 commit 6e0cc64
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions coraza/coraza.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function coraza:process_request()
data["Content-Length"] = tostring(handle:seek("end"))
handle:close()
end
body = function()
local fbody = function()
local handle, err = io.open(file)
if not handle then
return nil, err
Expand All @@ -130,14 +130,15 @@ function coraza:process_request()
return nil, ret
end
end
body = fbody()
end
end
local res, err = httpc:request_uri(
self.variables["CORAZA_API"] .. "/request",
{
method = "POST",
headers = data,
body = body()
body = body
}
)
if not res then
Expand Down

0 comments on commit 6e0cc64

Please sign in to comment.