diff --git a/lualib/resty/kong/upstream.lua b/lualib/resty/kong/upstream.lua index 7781a7bb..41df826d 100644 --- a/lualib/resty/kong/upstream.lua +++ b/lualib/resty/kong/upstream.lua @@ -20,7 +20,7 @@ base.allows_subsystem("http") ffi.cdef([[ int -ngx_http_lua_ffi_set_upstream_next(ngx_http_request_t *r, uint32_t next_upstream, char **err); +ngx_http_lua_ffi_set_next_upstream(ngx_http_request_t *r, uint32_t next_upstream, char **err); ]]) local type = type @@ -46,7 +46,7 @@ local next_upstream_table = { non_idempotent = 0x00004000, } -function _M.set_upstream_next(...) +function _M.set_next_upstream(...) local nargs = select("#", ...) if nargs == 0 then return "no argument" @@ -74,7 +74,7 @@ function _M.set_upstream_next(...) end local err = ffi.new("char *[1]") - local rc = C.ngx_http_lua_ffi_set_upstream_next(r, next_upstream, err) + local rc = C.ngx_http_lua_ffi_set_next_upstream(r, next_upstream, err) if rc ~= NGX_OK then return "failed to set upstream next: " .. ffi_str(err[0]) diff --git a/src/ngx_http_lua_kong_module.c b/src/ngx_http_lua_kong_module.c index 44eee728..f5484d35 100644 --- a/src/ngx_http_lua_kong_module.c +++ b/src/ngx_http_lua_kong_module.c @@ -218,7 +218,7 @@ ngx_http_lua_kong_get_next_upstream_mask(ngx_http_request_t *r, } int -ngx_http_lua_ffi_set_upstream_next(ngx_http_request_t *r, ngx_uint_t next_upstream, char **err) +ngx_http_lua_ffi_set_next_upstream(ngx_http_request_t *r, ngx_uint_t next_upstream, char **err) { ngx_http_lua_kong_ctx_t *ctx; diff --git a/t/013-upstream.t b/t/013-upstream.t index 9bca0c7f..4d07677c 100644 --- a/t/013-upstream.t +++ b/t/013-upstream.t @@ -162,7 +162,7 @@ __DATA__ --- response_body eval ["this is backend peer \$TEST_NGINX_RAND_PORT_4", "this is backend peer \$TEST_NGINX_RAND_PORT_4"] -=== TEST 3: lua resty.kong.upstream.set_upstream_next() behavior +=== TEST 3: lua resty.kong.upstream.set_next_upstream() behavior --- http_config upstream balancer { server 127.0.0.1; @@ -228,7 +228,7 @@ __DATA__ --- config access_by_lua_block { local upstream = require "resty.kong.upstream" - local err = upstream.set_upstream_next("error", "timeout", "http_500", "http_502", "http_503", "http_504", "http_404", "http_403", "http_429", "non_idempotent", "bala") + local err = upstream.set_next_upstream("error", "timeout", "http_500", "http_502", "http_503", "http_504", "http_404", "http_403", "http_429", "non_idempotent", "bala") if err then ngx.log(ngx.ERR, "failed to set upstream next: ", err) return ngx.exit(503)