change: added prefix http_ for http request. (#179)

This commit is contained in:
YuanSheng Wang 2019-07-01 17:24:38 +08:00 committed by WenMing
parent 53c3008f4f
commit 85f420977c
4 changed files with 25 additions and 25 deletions

View File

@ -49,7 +49,7 @@ http {
upstream apisix_backend {
server 0.0.0.1;
balancer_by_lua_block {
apisix.balancer_phase()
apisix.http_balancer_phase()
}
keepalive 32;
@ -58,11 +58,11 @@ http {
init_by_lua_block {
require "resty.core"
apisix = require("apisix")
apisix.init()
apisix.http_init()
}
init_worker_by_lua_block {
apisix.init_worker()
apisix.http_init_worker()
}
server {
@ -84,12 +84,12 @@ http {
location /apisix/admin {
allow 127.0.0.0/24;
content_by_lua_block {
apisix.admin()
apisix.http_admin()
}
}
ssl_certificate_by_lua_block {
apisix.ssl_phase()
apisix.http_ssl_phase()
}
location / {
@ -100,7 +100,7 @@ http {
set $upstream_uri '';
access_by_lua_block {
apisix.access_phase()
apisix.http_access_phase()
}
proxy_http_version 1.1;
@ -113,11 +113,11 @@ http {
proxy_pass $upstream_scheme://apisix_backend$upstream_uri;
header_filter_by_lua_block {
apisix.header_filter_phase()
apisix.http_header_filter_phase()
}
log_by_lua_block {
apisix.log_phase()
apisix.http_log_phase()
}
}
}

View File

@ -20,7 +20,7 @@ local match_opts = {}
local _M = {version = 0.1}
function _M.init()
function _M.http_init()
require("resty.core")
if require("ffi").os == "Linux" then
@ -43,7 +43,7 @@ function _M.init()
end
function _M.init_worker()
function _M.http_init_worker()
require("apisix.route").init_worker()
require("apisix.balancer").init_worker()
require("apisix.plugin").init_worker()
@ -89,7 +89,7 @@ local function run_plugin(phase, plugins, api_ctx)
end
function _M.ssl_phase()
function _M.http_ssl_phase()
local ngx_ctx = ngx.ctx
local api_ctx = ngx_ctx.api_ctx
@ -108,7 +108,7 @@ function _M.ssl_phase()
end
function _M.access_phase()
function _M.http_access_phase()
local ngx_ctx = ngx.ctx
local api_ctx = ngx_ctx.api_ctx
@ -175,12 +175,12 @@ function _M.access_phase()
end
function _M.header_filter_phase()
function _M.http_header_filter_phase()
run_plugin("header_filter")
end
function _M.log_phase()
function _M.http_log_phase()
local api_ctx = run_plugin("log")
if api_ctx then
if api_ctx.uri_parse_param then
@ -197,7 +197,7 @@ function _M.log_phase()
end
function _M.balancer_phase()
function _M.http_balancer_phase()
local api_ctx = ngx.ctx.api_ctx
if not api_ctx then
core.log.error("invalid api_ctx")
@ -211,7 +211,7 @@ end
do
local router
function _M.admin()
function _M.http_admin()
if not router then
router = admin_init.get()
end

View File

@ -33,7 +33,7 @@ add_block_preprocessor(sub {
my $init_by_lua_block = $block->init_by_lua_block // <<_EOC_;
require "resty.core"
apisix = require("apisix")
apisix.init()
apisix.http_init()
_EOC_
my $http_config = $block->http_config // '';
@ -54,7 +54,7 @@ _EOC_
upstream apisix_backend {
server 0.0.0.1;
balancer_by_lua_block {
apisix.balancer_phase()
apisix.http_balancer_phase()
}
keepalive 32;
@ -65,7 +65,7 @@ _EOC_
}
init_worker_by_lua_block {
require("apisix").init_worker()
require("apisix").http_init_worker()
}
server {
@ -101,7 +101,7 @@ _EOC_
lua_ssl_trusted_certificate cert/apisix.crt;
ssl_certificate_by_lua_block {
apisix.ssl_phase()
apisix.http_ssl_phase()
}
location = /apisix/nginx_status {
@ -112,7 +112,7 @@ _EOC_
location /apisix/admin {
content_by_lua_block {
apisix.admin()
apisix.http_admin()
}
}
@ -126,7 +126,7 @@ _EOC_
access_by_lua_block {
-- wait for etcd sync
ngx.sleep($wait_etcd_sync)
apisix.access_phase()
apisix.http_access_phase()
}
proxy_http_version 1.1;
@ -139,11 +139,11 @@ _EOC_
proxy_pass \$upstream_scheme://apisix_backend\$upstream_uri;
header_filter_by_lua_block {
apisix.header_filter_phase()
apisix.http_header_filter_phase()
}
log_by_lua_block {
apisix.log_phase()
apisix.http_log_phase()
}
}
_EOC_

View File

@ -10,7 +10,7 @@ add_block_preprocessor(sub {
my $init_by_lua_block = <<_EOC_;
require "resty.core"
apisix = require("apisix")
apisix.init()
apisix.http_init()
function test(route, ctx, count)
local balancer = require("apisix.balancer")