send status and bytes
This commit is contained in:
parent
c225bc38ad
commit
2be56b5045
|
@ -348,7 +348,12 @@ server {
|
||||||
if skylink and ngx.status >= ngx.HTTP_OK and ngx.status < ngx.HTTP_SPECIAL_RESPONSE then
|
if skylink and ngx.status >= ngx.HTTP_OK and ngx.status < ngx.HTTP_SPECIAL_RESPONSE then
|
||||||
local http = require("socket.http")
|
local http = require("socket.http")
|
||||||
local headers = { Cookie = ngx.req.get_headers()["Cookie"] }
|
local headers = { Cookie = ngx.req.get_headers()["Cookie"] }
|
||||||
local ok, statusCode, headers, statusText = http.request { url = "http://accounts:3000/track/download/" .. skylink, method = "POST", headers = headers }
|
local query = table.concat({ "status=" .. $status, "bytes=" .. $body_bytes_sent }, "&")
|
||||||
|
local ok, statusCode, headers, statusText = http.request {
|
||||||
|
url = "http://accounts:3000/track/download/" .. skylink .. "?" .. query,
|
||||||
|
method = "POST",
|
||||||
|
headers = headers
|
||||||
|
}
|
||||||
if statusCode ~= ngx.HTTP_NO_CONTENT then
|
if statusCode ~= ngx.HTTP_NO_CONTENT then
|
||||||
ngx.log(ngx.ERR, "accounts endpoint /track/download/" .. skylink .. " failed with error " .. statusCode)
|
ngx.log(ngx.ERR, "accounts endpoint /track/download/" .. skylink .. " failed with error " .. statusCode)
|
||||||
end
|
end
|
||||||
|
|
Reference in New Issue