Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5f34568

Browse files
authored
revert: drop configurable request JSON libraries (#13449)
1 parent 1a3467b commit 5f34568

22 files changed

Lines changed: 16 additions & 601 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ RUN apt update && export DEBIAN_FRONTEND=noninteractive \
2121
&& apt install -y sudo git make gcc tini
2222

2323
COPY Makefile .requirements apisix-master-0.rockspec ./
24-
COPY utils/install-dependencies.sh utils/install-rust-toolchain.sh utils/linux-install-luarocks.sh utils/
24+
COPY utils/install-dependencies.sh utils/linux-install-luarocks.sh utils/
2525

2626
RUN make install-runtime
2727

Makefile

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,7 @@ deps: install-runtime
137137
$(ENV_LUAROCKS) config $(ENV_LUAROCKS_FLAG_LOCAL) variables.OPENSSL_LIBDIR $(addprefix $(ENV_OPENSSL_PREFIX), /lib); \
138138
$(ENV_LUAROCKS) config $(ENV_LUAROCKS_FLAG_LOCAL) variables.OPENSSL_INCDIR $(addprefix $(ENV_OPENSSL_PREFIX), /include); \
139139
$(ENV_LUAROCKS) config $(ENV_LUAROCKS_FLAG_LOCAL) variables.YAML_DIR $(ENV_LIBYAML_INSTALL_PREFIX); \
140-
rustup_home=$${RUSTUP_HOME:-}; \
141-
cargo_home=$${CARGO_HOME:-}; \
142-
if [ -z "$$rustup_home" ]; then \
143-
if [ -d /usr/local/rustup ] && [ -w /usr/local/rustup ]; then rustup_home=/usr/local/rustup; else rustup_home=$$HOME/.rustup; fi; \
144-
fi; \
145-
if [ -z "$$cargo_home" ]; then \
146-
if [ -d /usr/local/cargo ] && [ -w /usr/local/cargo ]; then cargo_home=/usr/local/cargo; else cargo_home=$$HOME/.cargo; fi; \
147-
fi; \
148-
RUSTUP_HOME=$$rustup_home CARGO_HOME=$$cargo_home PATH=$$cargo_home/bin:$$PATH \
149-
$(ENV_LUAROCKS) install apisix-master-0.rockspec --tree deps --only-deps $(ENV_LUAROCKS_SERVER_OPT); \
140+
$(ENV_LUAROCKS) install apisix-master-0.rockspec --tree deps --only-deps $(ENV_LUAROCKS_SERVER_OPT); \
150141
else \
151142
$(call func_echo_warn_status, "WARNING: You're not using LuaRocks 3.x; please remove the luarocks and reinstall it via https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh"); \
152143
exit 1; \

apisix-master-0.rockspec

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ dependencies = {
8787
"api7-lua-resty-aws == 2.0.2-1",
8888
"multipart = 0.5.11-1",
8989
"luautf8 = 0.2.0-1",
90-
"lua-qjson = 0.1.0-1",
91-
"api7-lua-resty-simdjson = 0.1.1-1",
9290
}
9391

9492
build = {

apisix/cli/config.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ local _M = {
2929
enable_server_tokens = true,
3030
extra_lua_path = "",
3131
extra_lua_cpath = "",
32-
request_body_json_lib = "simdjson",
3332
proxy_cache = {
3433
cache_ttl = "10s",
3534
zones = {

apisix/cli/schema.lua

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ local config_schema = {
9292
},
9393
}
9494
},
95-
request_body_json_lib = {
96-
enum = {"cjson", "simdjson", "qjson"},
97-
default = "simdjson",
98-
},
9995
proxy_cache = {
10096
type = "object",
10197
properties = {

apisix/core/request.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
local lfs = require("lfs")
2323
local log = require("apisix.core.log")
24-
local request_json = require("apisix.core.request_json")
24+
local json = require("apisix.core.json")
2525
local io = require("apisix.core.io")
2626
local multipart = require("multipart")
2727
local core_str = require("apisix.core.string")
@@ -362,7 +362,7 @@ local function get_request_body_table(ctx, content_type)
362362
if not body then
363363
return nil, "could not get body: " .. (body_err or "request body is empty")
364364
end
365-
result, err = request_json.decode(body)
365+
result, err = json.decode(body)
366366
if not result then
367367
return nil, "could not parse JSON request body: " .. (err or "invalid JSON")
368368
end

apisix/core/request_json.lua

Lines changed: 0 additions & 98 deletions
This file was deleted.

apisix/plugins/ai-transport/auth-aws.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
require("resty.aws.config") -- reads env vars before init
2222
local aws = require("resty.aws")
23-
local request_json = require("apisix.core.request_json")
23+
local core = require("apisix.core")
2424
local signer = require("resty.aws.request.sign")
2525
local ngx = ngx
2626
local ngx_escape_uri = ngx.escape_uri
@@ -81,7 +81,7 @@ function _M.sign_request(params, aws_conf, region)
8181

8282
-- Serialize body to JSON string (SigV4 signs the exact bytes)
8383
if type(params.body) == "table" then
84-
local body_str, err = request_json.encode(params.body)
84+
local body_str, err = core.json.encode(params.body)
8585
if not body_str then
8686
return "failed to encode body: " .. (err or "")
8787
end

apisix/plugins/ai-transport/http.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
-- Provides HTTP client lifecycle management for AI provider requests.
2020

2121
local core = require("apisix.core")
22-
local request_json = require("apisix.core.request_json")
2322
local http = require("resty.http")
2423
local ngx_now = ngx.now
2524
local pairs = pairs
@@ -108,7 +107,7 @@ function _M.request(params, timeout)
108107
req_json = params.body
109108
else
110109
local err
111-
req_json, err = request_json.encode(params.body)
110+
req_json, err = core.json.encode(params.body)
112111
if not req_json then
113112
httpc:close()
114113
return nil, "encode body: " .. (err or "unknown"), {

ci/common.sh

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717

1818
set -ex
1919

20-
_APISIX_UTILS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/utils"
21-
# shellcheck source=../utils/install-rust-toolchain.sh
22-
. "${_APISIX_UTILS_DIR}/install-rust-toolchain.sh"
23-
unset _APISIX_UTILS_DIR
24-
2520
export_version_info() {
2621
source ./.requirements
2722
}
@@ -37,10 +32,6 @@ export_or_prefix() {
3732
create_lua_deps() {
3833
echo "Create lua deps"
3934

40-
export RUSTUP_HOME="${RUSTUP_HOME:-/usr/local/rustup}"
41-
export CARGO_HOME="${CARGO_HOME:-/usr/local/cargo}"
42-
export PATH="${CARGO_HOME}/bin:${PATH}"
43-
4435
make deps
4536

4637
# just for jwt-auth test
@@ -186,15 +177,13 @@ GRPC_SERVER_EXAMPLE_VER=20210819
186177

187178
linux_get_dependencies () {
188179
apt update
189-
apt install -y cargo cpanminus build-essential libncurses5-dev libreadline-dev libssl-dev perl libpcre3 libpcre3-dev libpcre2-dev xz-utils redis-tools
190-
install_rust_toolchain
180+
apt install -y cpanminus build-essential libncurses5-dev libreadline-dev libssl-dev perl libpcre3 libpcre3-dev libpcre2-dev xz-utils redis-tools
191181
apt remove -y curl
192182
apt-get install -y libyaml-dev
193183
wget https://github.com/mikefarah/yq/releases/download/3.4.1/yq_linux_amd64 -O /usr/bin/yq && sudo chmod +x /usr/bin/yq
194184

195185
# install curl with http3 support
196186
install_curl
197-
198187
}
199188

200189
function start_grpc_server_example() {

0 commit comments

Comments
 (0)