close httpc
This commit is contained in:
@@ -48,6 +48,9 @@ local function create_task(files, authHeader, sudoerToken)
|
|||||||
|
|
||||||
end
|
end
|
||||||
ngx.say(res.body)
|
ngx.say(res.body)
|
||||||
|
|
||||||
|
httpc:close()
|
||||||
|
|
||||||
ngx.exit(res.status)
|
ngx.exit(res.status)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ local function verifyJwtToken(token)
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
httpc:close()
|
||||||
|
|
||||||
if not res then
|
if not res then
|
||||||
ngx.log(ngx.ERR, "CAN'T VERIFY JWT TOKEN -> ", err)
|
ngx.log(ngx.ERR, "CAN'T VERIFY JWT TOKEN -> ", err)
|
||||||
ngx.exit(ngx.HTTP_FORBIDDEN)
|
ngx.exit(ngx.HTTP_FORBIDDEN)
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ local function create_task()
|
|||||||
body = body_text,
|
body = body_text,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
httpc:close()
|
||||||
|
|
||||||
if res == nil then
|
if res == nil then
|
||||||
ngx.log(ngx.ERR, "FAILED TO CONNECT TO *TASK_SERVER*", err)
|
ngx.log(ngx.ERR, "FAILED TO CONNECT TO *TASK_SERVER*", err)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ local function get_access_token()
|
|||||||
local no_exception, resp, resp_err = pcall(httpc.request_uri, httpc, remote_url,
|
local no_exception, resp, resp_err = pcall(httpc.request_uri, httpc, remote_url,
|
||||||
{
|
{
|
||||||
ssl_verify = false, -- 设置参数 ssl_verify 为false 不校验ssl证书
|
ssl_verify = false, -- 设置参数 ssl_verify 为false 不校验ssl证书
|
||||||
--pool = nil,
|
|
||||||
--pool_size = nil,
|
|
||||||
method = "GET",
|
method = "GET",
|
||||||
headers = {
|
headers = {
|
||||||
["HtyHost"] = wx_domain,
|
["HtyHost"] = wx_domain,
|
||||||
@@ -39,11 +37,9 @@ local function get_access_token()
|
|||||||
ngx.log(ngx.ERR, "GET ACCESS TOKEN *FAILED*", pl.write(resp_err))
|
ngx.log(ngx.ERR, "GET ACCESS TOKEN *FAILED*", pl.write(resp_err))
|
||||||
ngx.status = resp.status
|
ngx.status = resp.status
|
||||||
ngx.say(pl.write(resp_err))
|
ngx.say(pl.write(resp_err))
|
||||||
--httpc:close()
|
|
||||||
ngx.exit(resp.status)
|
ngx.exit(resp.status)
|
||||||
else
|
else
|
||||||
ngx.log(ngx.ERR, "RESP IS OK -> ", pl.write(resp.body))
|
ngx.log(ngx.ERR, "RESP IS OK -> ", pl.write(resp.body))
|
||||||
--httpc:close()
|
|
||||||
return cjson.decode(resp.body).d
|
return cjson.decode(resp.body).d
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -55,7 +51,6 @@ local function get_access_token()
|
|||||||
-- https://github.com/openresty/lua-resty-redis/issues/15
|
-- https://github.com/openresty/lua-resty-redis/issues/15
|
||||||
ngx.status = 401
|
ngx.status = 401
|
||||||
ngx.say(cjson.encode({r = false, d = "HtySudoerTokenErr"}))
|
ngx.say(cjson.encode({r = false, d = "HtySudoerTokenErr"}))
|
||||||
--httpc:close()
|
|
||||||
ngx.exit(401)
|
ngx.exit(401)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user