Skip to content

Commit

Permalink
Update HTTP_INTERNAL_SERVER_ERROR constant in Lua files
Browse files Browse the repository at this point in the history
  • Loading branch information
TheophileDiot committed Feb 6, 2024
1 parent f4285eb commit 1500263
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions discord/discord.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ local ERR = ngx.ERR
local WARN = ngx.WARN
local INFO = ngx.INFO
local ngx_timer = ngx.timer
local INTERNAL_SERVER_ERROR = ngx.HTTP_INTERNAL_SERVER_ERROR
local HTTP_INTERNAL_SERVER_ERROR = ngx.HTTP_INTERNAL_SERVER_ERROR
local HTTP_TOO_MANY_REQUESTS = ngx.HTTP_TOO_MANY_REQUESTS
local HTTP_OK = ngx.HTTP_OK
local http_new = http.new
Expand Down Expand Up @@ -225,7 +225,7 @@ function discord:api()
})
httpc:close()
if not res then
return self:ret(true, "error while sending request : " .. err_http, INTERNAL_SERVER_ERROR)
return self:ret(true, "error while sending request : " .. err_http, HTTP_INTERNAL_SERVER_ERROR)
end
if self.variables["DISCORD_RETRY_IF_LIMITED"] == "yes" and res.status == 429 and res.headers["Retry-After"] then
return self:ret(
Expand All @@ -235,7 +235,7 @@ function discord:api()
)
end
if res.status < 200 or res.status > 299 then
return self:ret(true, "request returned status " .. tostring(res.status), INTERNAL_SERVER_ERROR)
return self:ret(true, "request returned status " .. tostring(res.status), HTTP_INTERNAL_SERVER_ERROR)
end
return self:ret(true, "request sent to webhook", HTTP_OK)
end
Expand Down
4 changes: 2 additions & 2 deletions slack/slack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ local ERR = ngx.ERR
local WARN = ngx.WARN
local INFO = ngx.INFO
local ngx_timer = ngx.timer
local INTERNAL_SERVER_ERROR = ngx.HTTP_INTERNAL_SERVER_ERROR
local HTTP_INTERNAL_SERVER_ERROR = ngx.HTTP_INTERNAL_SERVER_ERROR
local HTTP_TOO_MANY_REQUESTS = ngx.HTTP_TOO_MANY_REQUESTS
local HTTP_OK = ngx.HTTP_OK
local http_new = http.new
Expand Down Expand Up @@ -162,7 +162,7 @@ function slack:api()
)
end
if res.status < 200 or res.status > 299 then
return self:ret(true, "request returned status " .. tostring(res.status), INTERNAL_SERVER_ERROR)
return self:ret(true, "request returned status " .. tostring(res.status), HTTP_INTERNAL_SERVER_ERROR)
end
return self:ret(true, "request sent to webhook", HTTP_OK)
end
Expand Down
6 changes: 3 additions & 3 deletions virustotal/virustotal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ local virustotal = class("virustotal", plugin)

local ngx = ngx
local ERR = ngx.ERR
local INTERNAL_SERVER_ERROR = ngx.HTTP_INTERNAL_SERVER_ERROR
local HTTP_INTERNAL_SERVER_ERROR = ngx.HTTP_INTERNAL_SERVER_ERROR
local HTTP_OK = ngx.HTTP_OK
local to_hex = str.to_hex
local http_new = http.new
Expand Down Expand Up @@ -296,13 +296,13 @@ function virustotal:api()
local ok, found, response =
self:request("/files/275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f") -- sha256 of eicar test file
if not ok then
return self:ret(true, "error while sending test data to virustotal : " .. found, INTERNAL_SERVER_ERROR)
return self:ret(true, "error while sending test data to virustotal : " .. found, HTTP_INTERNAL_SERVER_ERROR)
end
if not found then
return self:ret(
true,
"error while sending test data to virustotal : file not found on virustotal but it should be",
INTERNAL_SERVER_ERROR
HTTP_INTERNAL_SERVER_ERROR
)
end
return self:ret(true, "test data sent to virustotal, response: " .. encode(response), HTTP_OK)
Expand Down
4 changes: 2 additions & 2 deletions webhook/webhook.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ local ERR = ngx.ERR
local WARN = ngx.WARN
local INFO = ngx.INFO
local ngx_timer = ngx.timer
local INTERNAL_SERVER_ERROR = ngx.HTTP_INTERNAL_SERVER_ERROR
local HTTP_INTERNAL_SERVER_ERROR = ngx.HTTP_INTERNAL_SERVER_ERROR
local HTTP_TOO_MANY_REQUESTS = ngx.HTTP_TOO_MANY_REQUESTS
local HTTP_OK = ngx.HTTP_OK
local http_new = http.new
Expand Down Expand Up @@ -162,7 +162,7 @@ function webhook:api()
)
end
if res.status < 200 or res.status > 299 then
return self:ret(true, "request returned status " .. tostring(res.status), INTERNAL_SERVER_ERROR)
return self:ret(true, "request returned status " .. tostring(res.status), HTTP_INTERNAL_SERVER_ERROR)
end
return self:ret(true, "request sent to webhook", HTTP_OK)
end
Expand Down

0 comments on commit 1500263

Please sign in to comment.