Skip to content

Commit c82b6f2

Browse files
authored
Merge branch 'apache:master' into remove-openldap
2 parents 5cf1be3 + 88da2ec commit c82b6f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1567
-293
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ jobs:
136136
[[ ${{ steps.test_env.outputs.type }} != first ]] && sudo ./ci/init-${{ steps.test_env.outputs.type }}-test-service.sh after
137137
echo "Linux launch services, done."
138138
- name: Start Dubbo Backend
139-
if: matrix.os_name == 'linux_openresty' && steps.test_env.outputs.type == 'plugin'
139+
if: matrix.os_name == 'linux_openresty' && (steps.test_env.outputs.type == 'plugin' || steps.test_env.outputs.type == 'last')
140140
run: |
141141
sudo apt install -y maven
142142
cd t/lib/dubbo-backend

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,9 @@ install: runtime
375375
$(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/stream/xrpc/protocols/redis
376376
$(ENV_INSTALL) apisix/stream/xrpc/protocols/redis/*.lua $(ENV_INST_LUADIR)/apisix/stream/xrpc/protocols/redis/
377377

378+
$(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/stream/xrpc/protocols/dubbo
379+
$(ENV_INSTALL) apisix/stream/xrpc/protocols/dubbo/*.lua $(ENV_INST_LUADIR)/apisix/stream/xrpc/protocols/dubbo/
380+
378381
$(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/utils
379382
$(ENV_INSTALL) apisix/utils/*.lua $(ENV_INST_LUADIR)/apisix/utils/
380383

apisix/cli/ngx_tpl.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,12 @@ http {
365365
log_format main escape={* http.access_log_format_escape *} '{* http.access_log_format *}';
366366
uninitialized_variable_warn off;
367367
368+
{% if http.access_log_buffer then %}
369+
access_log {* http.access_log *} main buffer={* http.access_log_buffer *} flush=3;
370+
{% else %}
368371
access_log {* http.access_log *} main buffer=16384 flush=3;
369372
{% end %}
373+
{% end %}
370374
open_file_cache max=1000 inactive=60;
371375
client_max_body_size {* http.client_max_body_size *};
372376
keepalive_timeout {* http.keepalive_timeout *};
@@ -631,6 +635,14 @@ http {
631635
proxy_ssl_trusted_certificate {* ssl.ssl_trusted_certificate *};
632636
{% end %}
633637
638+
# opentelemetry_set_ngx_var starts
639+
{% if opentelemetry_set_ngx_var then %}
640+
set $opentelemetry_context_traceparent '';
641+
set $opentelemetry_trace_id '';
642+
set $opentelemetry_span_id '';
643+
{% end %}
644+
# opentelemetry_set_ngx_var ends
645+
634646
# http server configuration snippet starts
635647
{% if http_server_configuration_snippet then %}
636648
{* http_server_configuration_snippet *}

apisix/cli/ops.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,10 @@ Please modify "admin_key" in conf/config.yaml .
542542
end
543543
end
544544

545+
local opentelemetry_set_ngx_var
546+
if enabled_plugins["opentelemetry"] and yaml_conf.plugin_attr["opentelemetry"] then
547+
opentelemetry_set_ngx_var = yaml_conf.plugin_attr["opentelemetry"].set_ngx_var
548+
end
545549
-- Using template.render
546550
local sys_conf = {
547551
lua_path = env.pkg_path_org,
@@ -562,6 +566,7 @@ Please modify "admin_key" in conf/config.yaml .
562566
control_server_addr = control_server_addr,
563567
prometheus_server_addr = prometheus_server_addr,
564568
proxy_mirror_timeouts = proxy_mirror_timeouts,
569+
opentelemetry_set_ngx_var = opentelemetry_set_ngx_var
565570
}
566571

567572
if not yaml_conf.apisix then

apisix/core/response.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ function resp_exit(code, ...)
7070
error("failed to encode data: " .. err, -2)
7171
else
7272
idx = idx + 1
73-
t[idx] = body .. "\n"
73+
t[idx] = body
74+
idx = idx + 1
75+
t[idx] = "\n"
7476
end
7577

7678
elseif v ~= nil then
@@ -80,7 +82,7 @@ function resp_exit(code, ...)
8082
end
8183

8284
if idx > 0 then
83-
ngx_print(concat_tab(t, "", 1, idx))
85+
ngx_print(t)
8486
end
8587

8688
if code then

apisix/http/route.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,16 @@ function _M.create_radixtree_uri_router(routes, uri_routes, with_parameter)
103103
end
104104

105105

106-
function _M.match_uri(uri_router, match_opts, api_ctx)
107-
core.table.clear(match_opts)
106+
function _M.match_uri(uri_router, api_ctx)
107+
local match_opts = core.tablepool.fetch("route_match_opts", 0, 4)
108108
match_opts.method = api_ctx.var.request_method
109109
match_opts.host = api_ctx.var.host
110110
match_opts.remote_addr = api_ctx.var.remote_addr
111111
match_opts.vars = api_ctx.var
112112
match_opts.matched = core.tablepool.fetch("matched_route_record", 0, 4)
113113

114114
local ok = uri_router:dispatch(api_ctx.var.uri, match_opts, api_ctx, match_opts)
115+
core.tablepool.release("route_match_opts", match_opts)
115116
return ok
116117
end
117118

apisix/http/router/radixtree_host_uri.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,6 @@ local function create_radixtree_router(routes)
142142
return true
143143
end
144144

145-
146-
local match_opts = {}
147145
function _M.match(api_ctx)
148146
local user_routes = _M.user_routes
149147
local _, service_version = get_services()
@@ -162,7 +160,7 @@ end
162160
function _M.matching(api_ctx)
163161
core.log.info("route match mode: radixtree_host_uri")
164162

165-
core.table.clear(match_opts)
163+
local match_opts = core.tablepool.fetch("route_match_opts", 0, 16)
166164
match_opts.method = api_ctx.var.request_method
167165
match_opts.remote_addr = api_ctx.var.remote_addr
168166
match_opts.vars = api_ctx.var
@@ -181,11 +179,13 @@ function _M.matching(api_ctx)
181179
api_ctx.curr_req_matched._host = api_ctx.real_curr_req_matched_host:reverse()
182180
api_ctx.real_curr_req_matched_host = nil
183181
end
182+
core.tablepool.release("route_match_opts", match_opts)
184183
return true
185184
end
186185
end
187186

188187
local ok = only_uri_router:dispatch(api_ctx.var.uri, match_opts, api_ctx, match_opts)
188+
core.tablepool.release("route_match_opts", match_opts)
189189
return ok
190190
end
191191

apisix/http/router/radixtree_uri.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ local _M = {version = 0.2}
2727

2828
local uri_routes = {}
2929
local uri_router
30-
local match_opts = {}
3130
function _M.match(api_ctx)
3231
local user_routes = _M.user_routes
3332
local _, service_version = get_services()
@@ -51,8 +50,7 @@ end
5150

5251
function _M.matching(api_ctx)
5352
core.log.info("route match mode: radixtree_uri")
54-
55-
return base_router.match_uri(uri_router, match_opts, api_ctx)
53+
return base_router.match_uri(uri_router, api_ctx)
5654
end
5755

5856

apisix/http/router/radixtree_uri_with_parameter.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ local _M = {}
2727

2828
local uri_routes = {}
2929
local uri_router
30-
local match_opts = {}
3130
function _M.match(api_ctx)
3231
local user_routes = _M.user_routes
3332
local _, service_version = get_services()
@@ -51,8 +50,7 @@ end
5150

5251
function _M.matching(api_ctx)
5352
core.log.info("route match mode: radixtree_uri_with_parameter")
54-
55-
return base_router.match_uri(uri_router, match_opts, api_ctx)
53+
return base_router.match_uri(uri_router, api_ctx)
5654
end
5755

5856

apisix/plugins/ext-plugin/init.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ local ipairs = ipairs
6565
local pairs = pairs
6666
local tostring = tostring
6767
local type = type
68+
local ngx = ngx
6869

6970

7071
local events_list
@@ -655,6 +656,13 @@ local rpc_handlers = {
655656
end
656657
end
657658

659+
local body_len = rewrite:BodyLength()
660+
if body_len > 0 then
661+
local body = rewrite:BodyAsString()
662+
ngx.req.read_body()
663+
ngx.req.set_body_data(body)
664+
end
665+
658666
local len = rewrite:RespHeadersLength()
659667
if len > 0 then
660668
local rewrite_resp_headers = {}

0 commit comments

Comments
 (0)